Trend charts display key metrics with comparison values, helping you spot changes in log data at a glance. You can add trend charts to dashboards for continuous monitoring.
Prerequisites
-
Data has been collected. For more information, see Collect text logs from servers.
-
Indexes have been created. For more information, see Create indexes.
-
A dashboard has been created. For more information, see Create a dashboard quickly.
Overview

-
Query and analyze data: Count the page views (PVs) of a webpage in the console to verify your log data.
-
Configure a trend chart: Add a trend chart named
statistical-chart, configure a comparison value, and add the chart to a dashboard.
Step 1: Query and analyze data
Log on to the Simple Log Service console. In the Projects section, click the project you want.

-
In the left-side navigation pane, click Log Storage. In the Logstore list, click the target Logstore.
-
Enter the following query and analysis statement to count webpage PVs. Then, click Search & Analyze to view the results.
*| select diff[1] as pv, diff[2] as previous_day_pv, (diff[1] - diff[2])/diff[2] as growth from ( select compare(pv, 86400) as diff from ( select count(1) as pv from log ) )
Step 2: Configure a trend chart
1. Add a trend chart
In the left-side navigation pane, choose . In the Dashboard list, click the desired dashboard. In the upper-right corner of the dashboard, click Edit. In edit mode, click .
2. Configure a title
In the configuration panel on the right, choose . Then, under , set Title to statistical-chart.
3. Configure the trend chart
On the right side of the page, set to Background and to Trend Chart.
-
: Select Background to apply a color to the background and the trend chart. The default color is green.
-
: Displays the chart as a Trend Chart.
4. Configure a comparison value
In the configuration panel on the right, on the General Configurations tab, configure the Search & Analysis Settings. Set the time range, select the Logstore, enter your query and analysis statement, and click Apply to preview the chart.
-
: Select the
pvfield to display in the trend chart. -
: Select the
growthfield, which represents the rate of change. -
: Enter
Day-over-dayas the description for the comparison value. -
: Because the
growthfield represents a rate of change, set the format topercent(1-100). -
: Set the number of decimal places to two.
The query statement uses the compare function to calculate day-over-day PV changes. For other settings, set trend comparison threshold to 0, number of digits after decimal point to 2, and description value font size to 23.
5. Save the trend chart and the dashboard
-
In the upper-right corner of the statistical chart editing page, click OK.
-
In the upper-right corner of the dashboard editing page, click Save.