All Products
Search
Document Center

Simple Log Service:Specify thresholds for a statistical chart

Last Updated:Dec 17, 2024

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

Configuration effect

ff454563dcdb0fb734205803218743e8 2aed352e908ee1c0236c225531159aa8

  1. 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.

  2. 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 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.

Step 1: Query and analyze data

  1. Log on to the Simple Log Service console. In the Projects section, click the project that you want to manage.

    image

  2. In the left-side navigation pane, click Log Storage. In the Logstores list, click the Logstore that you want to manage.

    image

  3. 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 Dashboard > Dashboards. 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 Add > Add Chart.

image

2. Configure a statistical chart

  1. 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.

    image

  2. 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.

    1. 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.

      image

    2. 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.

      image

3. Save the statistical chart and the dashboard

  1. In the upper-right corner of the Edit Chart page, click OK.

    image

  2. In the upper-right corner of the dashboard page, click Save.

    image