All Products
Search
Document Center

Simple Log Service:Add a table sparkline

Last Updated:Oct 24, 2024

After NGINX access logs are collected and stored on Simple Log Service, you can use query and analysis statements to view the access volume for all request paths and visualize the access volume in a dashboard. If you want to track changes for different requests in the access volume, you can use the sparkline feature of the table.

Prerequisites

Step 1: Query and analyze data

  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 Log Storage. In the Logstores list, click the logstore you want.

    image

  3. Enter the query and analysis statement, and then click Last 15 Minutes to set the time range for your query and analysis.

    For example, you can use the following statement to query the sources of requests by HTTP referer, and aggregate the corresponding body byte sizes:

    * | SELECT http_referer, array_agg(body_bytes_sent) as body_bytes_sent from log GROUP BY http_referer

    For more information about array_agg, see array_agg function.

Step 2: Add a table

  1. In the left-side navigation pane, choose Dashboard > Dashboards. In the dashboard list, click the dashboard you want. In the upper-right corner of the dashboard page, click Edit. In edit mode, click Add > Add Chart.

    image

  2. On the General Configurations tab, click the Table Pro icon in the Chart Types section. On the Search & Analysis tab, select Logstore (SQL) and choose the logstore you want, and enter the query statement. Select a time range, such as Last 15 Minutes, and click OK.

    image

Step 3: Add a sparkline

Add a line chart

  1. On the Field Configuration tab, click Add Field, and then select the column name from the drop-down list.

  2. Click Add Configuration, select Field/Column Settings > Cell Display Mode, and select Line Chart.

The settings and results are shown in the figure below.

image

Add an area chart

  1. On the Field Configuration tab, click Add Field, and then select the column name from the drop-down list.

  2. Click Add Configuration, select Field/Column Settings > Cell Display Mode, and select Area Chart.

The settings and results are shown in the figure below.

image

Add a column chart

  1. On the Field Configuration tab, click Add Field, and then select the column name from the drop-down list.

  2. Click Add Configuration, select Field/Column Settings > Cell Display Mode, and select Column Chart.

The settings and results are shown in the figure below.

image