Splunk Search

Comparing averages and counts between different hours

dantonag
Explorer

Hello,
I have a search that returns records like those:

PivotField1 hour1 countOfCalls averageDuration

PivotField1 hour2 countOfCalls averageDuration

PivotField2 hour1 countOfCalls averageDuration

PivotField2 hour2 countOfCalls averageDuration

...

I'd like to "group by" pivot fields and show counts and averages on the same line, like this:

PivotField1 countOfCallsForhour1 averageDurationForhour1 countOfCallsForhour2 averageDuration_forhour2

PivotField2 countOfCallsForhour1 averageDurationForhour1 countOfCallsForhour2 averageDuration_forhour2

...

Is this possible with a search?

Thanks

Tags (2)
0 Karma
1 Solution

lguinn2
Legend

Yes, there is! Here is a link to a blog post that discusses how to Compare two time ranges in one report.

There are also several discussions in this forum on similar topics. Here is one: Comparing today's data with last week's data

If this isn't sufficient information, feel free to ask for more details.

View solution in original post

yannK
Splunk Employee
Splunk Employee

If your value are extracted in fields, by example something like
pivot=PivotField1 hour=hour1 countOfCalls=X averageDuration=Y


mysearch | chart sum(countOfCalls) avg(averageDuration) over hour by pivot

0 Karma

lguinn2
Legend

Yes, there is! Here is a link to a blog post that discusses how to Compare two time ranges in one report.

There are also several discussions in this forum on similar topics. Here is one: Comparing today's data with last week's data

If this isn't sufficient information, feel free to ask for more details.

dantonag
Explorer

Thanks, this helped a lot. The key was the "append" function.

0 Karma
Get Updates on the Splunk Community!

Exporting Splunk Apps

Join us on Monday, October 21 at 11 am PT | 2 pm ET!With the app export functionality, app developers and ...

Cisco Use Cases, ITSI Best Practices, and More New Articles from Splunk Lantern

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Build Your First SPL2 App!

Watch the recording now!.Do you want to SPL™, too? SPL2, Splunk's next-generation data search and preparation ...