Working with time series - The timechart command
One way to analyze time series in Splunk is the command timechart.
This command performs a statistical aggregation on a field to build charts, with time as the X axis. The timechart command accepts the same functions and clauses as stats.
The example below shows a simple count over the data in the web index for the whole available time range.
index=web | timechart count
You can now open the Visualization tab to see the chart created by this command.

In this example, the data is counted per day, following the default aggregation described on Splunk's website. If the range is changed in the time picker, it follows the table below:
This span defines the series on the X axis of your chart, and it can be changed with the span parameter, indicating the time interval to use. The span parameter accepts the following time units:

Using the units above, let's split the information into one-hour intervals:
index=web | timechart span=1h count
To wrap up, the timechart command also lets you group the data by a specific field, as in the following example:
index=web | timechart span=1h count by clientip
Want to practice? Try the free We Challenge sample, with Splunk questions and explanations.
To start from scratch, see the Introduction to Splunk course on Udemy (in Portuguese). For your team, see WeValuate's Splunk training.
Questions about the post? Content suggestions? Corrections? Criticism or praise?
Please contact us at wevaluatebr@gmail.com and we will reply as soon as possible.
If you liked it, share this post on your social networks and help us spread the word!



Comments