All Products
Search
Document Center

Simple Log Service:Configure a statistical chart that supports multi-statement query

Last Updated:Dec 17, 2024

You can configure multiple query statements for a statistical chart. This way, multiple single value charts can be displayed in a statistical chart based on the results of the query statements. You can also configure personalized display settings on the Field Configuration tab. This topic describes how to configure a statistical chart that supports multi-statement query.

Prerequisites

Configuration effect

image

  1. Query and analyze data: In the Simple Log Service console, query the numbers of unique visitors (UVs) and page views (PVs) of a web page. Make sure that log data is integral and accurate.

  2. Configure a statistical chart that supports multi-statement query: Add a statistical chart to display the numbers of UVs and PVs of the web page. Display the background colors of the single value charts for UVs and PVs to orange and blue and add the statistical chart to a dashboard.

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 query statements and click Search & Analyze to view the logs.

    • Query the number of UVs.

      status < 400 | SELECT approx_distinct(client_ip) AS UV
    • Query the number of PVs.

      status < 400 | SELECT count(*) AS PV

Step 2: Configure a statistical chart that supports multi-statement query

1. Add a statistical chart

In the left-side navigation pane, 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 multi-statement query

On the right side of the Edit Chart page, choose General Configurations > Chart Types > image based on the following figure. On the left side of the Edit Chart page, configure the query time range, Logstores, and query statements 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.

  • General Configurations > Search & Analysis Settings > A: Select UV to display the UV field in the results of Query Statement A in the statistical chart.

  • General Configurations > Search & Analysis Settings > B: Select PV to display the PV field in the results of Query Statement B in the statistical chart.

image

3. Specify colors

On the right side of the Edit Chart page, click the Field Configuration tab and specify colors for the statistical chart. For more information, see Single value chart (Pro).

  • A: In the A section, set the Standard Configurations > Color Scheme parameter to Solid and specify orange for the results of Query Statement A.

  • B: In the B section, set the Standard Configurations > Color Scheme parameter to Solid and specify blue for the results of Query Statement B.

image

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