Time series mode
When you add a chart to a dashboard, you can enable time series mode to visualize trends in your query and analysis results over time. Time series mode merges results from multiple queries for a more intuitive and detailed view of how data changes.
Key concepts
Currently, only line chart (Pro) and flow chart (Pro) support time series mode.
Time series mode shows how one or more datasets change over time. It merges results from multiple queries to provide a more intuitive and detailed view of trends in your query and analysis results.
The time field is a default attribute for each log in Simple Log Service. It indicates the timestamp specified for a log when it is written to the service. The time field is a Unix timestamp in seconds. You can use the time field to build charts in time series mode and avoid complex time function operations.
Time series mode differs from non-time series mode in the following ways:
Time series mode
The system automatically optimizes the time span for a more uniform time distribution.
Time is displayed in
mm:ssformat on the x-axis and inYYYY-MM-DD hh:mm:ssformat in the popover.Supports adding multiple queries and analyses.
Non-time series mode
The x-axis may have a wide and uneven time distribution.
The x-axis and popovers display time in the Unix timestamp format. Changing the format requires using time functions in your query statement.
Supports only a single query and analysis.
Benefits
The uniform time distribution on the x-axis better reflects how metrics change over time.
The time scale on the x-axis automatically adjusts based on the time span, revealing more detail in the query and analysis results.
Displaying time on the x-axis in
mm:ssformat provides a more intuitive view of the time span and detailed time points.Supports merging results from multiple queries and analyses.
Limitations
The x-axis time field must be in Unix timestamp format (in seconds) or a standard time format. Standard time formats include UTC time (for example, 2022-02-03T22:30:05+08:00) or any format that can be parsed into year, month, day, hour, minute, and second components (for example, YYYY/MM/DD hh:mm:ss), which can include a time zone.
Configuration examples
Example 1: Display daily PV and UV trends
You can enable time series mode and configure its settings when you create a chart. For more information about how to create a chart and configure a line chart, see Add a chart to a dashboard and Line Chart. The key configuration settings are as follows.
① Select the LogStore that contains your logs and enter a query statement.
* | select __time__ - __time__ % 3600 as time, COUNT(*) as pv, COUNT(DISTINCT remote_addr) as uv group by time order by time limit 10000__time__ - __time__ % 3600 as timespecifies a time interval of 1 hour with the aliastime.The
remote_addrfield indicates the IP address of the client. You can use this field to count the number of unique visitors (UV).Page views (PV) are calculated by counting the total number of logs.
② Set the time range to 1 Day(Relative).
③ Click Apply to run the query statement.
④ On the General Configuration tab, in the Query and Analysis section, set the Y Axis to pv and uv.
⑤ Turn on the Time Series Mode switch.
Example 2: Display inbound and outbound traffic trends
You can enable time series mode and configure its settings when you create a chart. For more information about how to create a chart and configure a line chart, see Add a chart to a dashboard and Line Chart. The key configuration settings are as follows.
① Select the LogStore that contains your logs and enter a query statement.
* | select __time__ - __time__ % 3600 as time , sum(body_bytes_sent)* -1 as net_out, sum(request_length) as net_in group by time order by time limit 10000__time__ - __time__ % 3600 as timerepresents a time interval of 1 hour, withtimeas the alias.The
body_bytes_sentfield indicates the number of bytes in the response body sent to the client. This field is used to calculate outbound traffic.The
request_lengthfield indicates the size of the request in bytes, including the request line, request header, and request body. This field is used to calculate inbound traffic.
② Set the time range to 1 Day(Relative).
③ Click Apply to run the query statement.
④ On the General Configuration tab, in the Query and Analysis section, set the Y Axis to net_out and net_in.
⑤ Turn on the Time Series Mode switch.