Reporting: Compare hourly sums between multiple days
timechart is great for creating charts that show trends over time, it has strict boundaries limiting what it can do. There are times when you're better off with the
chart command, which can provide more flexibility.
This is an example of how you might want to use
chart to compare values collected over several days. This is something you can't do with
You have two searches that are nearly identical. They both show the hourly sum of the
P field over a 24-hour period. The only difference is that one search covers a period ten days in the past, while the other covers a period nine days into the past:
earliest=-10d latest=-9d | timechart span="1h" sum(P)
earliest=-9d latest=-8d | timechart span="1h" sum(P)
What you'd like to do is create a column chart that combines the results of these two searches, so you can see the sum of
P for 3pm, ten days ago side-by-side with the sum of
P for 3pm, nine days ago.
You can't pull this off with the
timechart command. But you can do it with the
chart command, and it's pretty simple. Set up a search that covers both days, and then have it create a "sum of P" column for each distinct
date_day combination found in the search events.
The finished search looks like this:
earliest=-10d latest=-8d | chart sum(P) by date_hour date_day
This produces a single chart with 24 slots, one for each hour of the day. Each slot contains two columns that enable you to compare hourly sums between the two days covered by the time range of the report.
For a primer on reporting searches and how they're constructed, see "Use reporting commands" in the User Manual.
For more information about
timechart functions, see "Functions for stats, chart, and timechart" in the Search Reference Manual.
Reporting: Build a chart of multiple data series
Monitor and alert on Windows disk usage
This documentation applies to the following versions of Splunk® Enterprise: 4.3, 4.3.1, 4.3.2, 4.3.3, 4.3.4, 4.3.5, 4.3.6, 4.3.7