A pie chart is used to show the percentage of each category of data. The arc length of each slice in a pie chart is proportionate to the quantity that is represented by each category. A pie chart is divided into multiple slices based on the percentages of categories. Each slice shows the percentage of a category of data. The sum of all percentages is equal to 100%. This topic describes how to configure multiple query statements and use a pie chart to display the results of multiple query statements.
Prerequisites
Data is collected. For more information, see Collect text logs from servers.
Indexes are created. For more information, see Create indexes.
A dashboard is created. For more information, see Create a dashboard.
Configuration effect
Query and analyze data: You can query and analyze the collected logs in the Simple Log Service console. For example, you can retrieve logs, aggregate logs, and collect statistics on logs.
Configure a pie chart: You can add multiple query statements on the Search & Analysis tab, configure a pie chart, and add the pie chart to a dashboard.
Step 1: Query and analyze data
Log on to the Simple Log Service console. In the Projects section, click the project you want.
In the left-side navigation pane, click Log Storage. In the Logstores list, click the Logstore that you want to manage.
On the page that appears, enter the following query statement in the search box and click Search & Analyze to view the logs.
* | SELECT request_method, COUNT(*) as c group by request_method
Step 2: Configure a pie chart
1. Add a pie chart
In the left-side navigation pane, choose
. In the Dashboard list, click the dashboard that you want to manage. In the upper-right corner of the dashboard page, click Edit. In edit mode, choose .2. Configure multiple query statements
Multi-statement query with merging data
Configure parameters on the Search & Analysis tab: On the left side of the Edit Chart page, configure the query time range, Logstore, Query statement A, and Query statement B based on the following figure. The following sample code shows Query statement A and Query statement B:
* | SELECT request_method, COUNT(*) as c group by request_method
Configure parameters on the Data Conversion tab: On the left side of the Edit Chart page, click the Data Conversion tab, click Add Conversion, select Group By from the drop-down list, and then click Add Field. In the request_method section, select Group By from the drop-down list. In the c section, select Calculate and Sum from the drop-down lists based on the following figure.
Configure parameters on the General Configurations tab: On the right side of the Edit Chart page, click the General Configurations tab, choose
, and then configure parameters in the Query and Analysis Configurations section based on the following figure.
: The data of the pie chart is classified based on therequest_method
field.
: The numeric values are displayed based on thec
field.
View the configuration effects.
Multi-statement query without merging data
On the right side of the Edit Chart page, choose
based on the following figure. On the left side of the page that appears, configure the query time range, Logstore, and query statement for the chart. After you complete the configuration, click Apply in the upper part of the Edit Chart page to view the configuration effects of the pie chart.
: The data of the pie chart is classified based on therequest_method
field.
: The numeric values are displayed based on thec
field.
View the configuration effects.