You can configure custom thresholds to modify the display effects of a statistical chart. This way, you can intuitively monitor whether data exceeds the specified threshold and identify abnormal changes at the earliest opportunity. This topic describes how to specify thresholds for a statistical chart.
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: Query the request success rate of a web page in the Simple Log Service console. Make sure that log data is integral and accurate.
Specify thresholds for a statistical chart: Add a dashboard and add a statistical chart named
request-success-rate
to the dashboard. Specify a threshold and the threshold-based background colors for thesuccess_rate
field. If the success rate is greater than 70%, the statistical chart is displayed in green. If the success rate is less than or equal to 70%, the statistical chart is displayed in red.
Step 1: Query and analyze data
Log on to the Simple Log Service console. In the Projects section, click the project that you want to manage.
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 to query the request success rate of a web page and click Search & Analyze to view the logs.
(*)|select round(sum(if(status < 300, 1, 0)) * 100.0 / count(1), 2) as success_rate
Step 2: Specify thresholds for a statistical chart
1. Add a statistical chart
Log on to the Simple Log Service console and select the project that you want to manage. In the left-side navigation pane of the page that appears, 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 a statistical chart
Configure parameters on the General Configurations tab of the statistical chart: On the right side of the Edit Chart page, select Single Value Chart Pro in the Chart Types section and configure the Title parameter in the Basic Configurations section based on the following figure. On the left side of the Edit Chart page, configure the query time range, Logstore, and query statement for the statistical chart. After you complete the configuration, click Apply in the upper part of the Edit Chart page to view the configuration effects of the statistical chart.
Configure parameters on the Field Configuration tab of the statistical chart: Specify a threshold and the threshold-based background colors for the success_rate field. If the success rate is greater than 70%, the statistical chart is displayed in green. If the success rate is less than or equal to 70%, the statistical chart is displayed in red.
On the right side of the Edit Chart page, click the Field Configuration tab. On the tab, click Add Field and select A > success_rate from the drop-down list.
Configure the following parameters for the success_rate field and specify the background colors for the statistical chart:
Standard Configurations > Unit: Set the unit for the value of the
success_rate
field to %.Chart Style > Value Font Size: Set the font size for the value of the
success_rate
field to 70.Threshold > Threshold: Set the threshold for the value of the success_rate field to 70.
Standard Configurations > Color Scheme: Select a color scheme for the statistical chart. The background color of the statistical chart is displayed based on the threshold that you specify. If the value of the
success_rate
field is less than or equal to 70%, the background color of the statistical chart is red. If the value of the success_rate field is greater than 70%, the background color of the statistical chart is green.Chart Style > Color Mode: Select Background to specify the background color for the statistical chart.
Chart Style > Font Color: Set the font color for the value of the
success_rate
field to #ffffff, which specifies white.For more information, see Attributes of charts.
3. Save the statistical chart and the dashboard
In the upper-right corner of the Edit Chart page, click OK.
In the upper-right corner of the dashboard page, click Save.