All Products
Search
Document Center

Simple Log Service:Configure a Markdown chart based on query and analysis results

Last Updated:Dec 09, 2024

Simple Log Service (SLS) allows you to add Markdown charts to a dashboard. You can insert multiple elements, such as background information, chart descriptions, page notes, and extended information into Markdown charts to make your dashboard page more informative. This topic describes how to configure a Markdown chart based on query and analysis results.

Prerequisites

Configuration result preview

image

  1. Query and analyze logs: Query and analyze logs in the SLS console. The operations involved include log retrieval, log aggregation, and log statistics.

  2. Configure a Markdown chart: Configure a Markdown chart based on the query and analysis results and then add the chart to a dashboard.

Step 1: Query and analyze logs

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

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

    image

  3. Enter the following query statements in the input box and click Search & Analyze to check whether logs can be queried as expected.

    • Query the total number of logs:

      * | SELECT COUNT(*) as COUNT
    • Query the current status with the highest number of service requests and the number of requests:

      * | SELECT status, COUNT(*) as c group by status order by c DESC limit 1
    • Query the current status with the highest number of abnormal service requests and the number of requests:

      * and status > 400 | SELECT status, COUNT(*) as c group by status order by c DESC limit 1

Step 2: Configure a Markdown chart

  1. In the left-side navigation pane, move the pointer over the Dashboard icon and then select Dashboards. In the Dashboard list, click the dashboard to which you want to add a chart. In the upper-right corner of the page that appears, click Edit to enter the dashboard edit mode. Click Add and then click Add Chart.

    image

  2. On the right side of the page, click the image icon in the Chart Types section of the General Configurations tab. On the left side of the page, select a time range and a Logstore, and enter query statements. Then, click Apply to view the chart configuration result.

    Important
    • If you add only one query statement, directly use the field name. Example: ${{Field name}}.

    • If you add multiple query statements, add query statement IDs before field names. This helps prevent field name conflicts. Example: ${{Query ID.Field name}}. For information about the limits of query, see the Limits section of the "Query and analysis" topic.

    • General Configurations > Markdown Configurations > Center Method > Horizontally Center: sets the chart to be horizontally centered.

    • General Configurations > Markdown Configurations > Center Method > Vertically Center: sets the chart to be vertically centered.

    image