Splunk Search

Calculating Trends in tables

andreafebbo
Communicator

Hi all.

I'd like to create a table like the following columns:

server - event count - event count last period

what do I mean by that?

I have to do a count by of the events, and this is trivial.

base query | stats count as events by source 

now i have a selector that let me select the period (the classic splunk time selector).

what i need is the following:
if the selector is "last week" i need to count in the first column the events of the last week and in the second column the events of the week before that

if the selector is "last mount" i need to count in the first column the events of the last mount and in the second column the events of the mount before that

etc...

Id like to do that without messing with html, xml or any other language. I'd like, if possible, a plain splunk search.

Thanks a lot.

Andrea

1 Solution

jpolcari
Communicator

This looks like a good use of bucket https://docs.splunk.com/Documentation/Splunk/6.4.2/SearchReference/Bucket

This should work for you:

base query earliest=-30d | bucket _time span=1d |  stats count as events by source 

Basically, the bucket command will break your search results into specified time periods. In the search above we take the last month and break them into buckets per day.

View solution in original post

jpolcari
Communicator

This looks like a good use of bucket https://docs.splunk.com/Documentation/Splunk/6.4.2/SearchReference/Bucket

This should work for you:

base query earliest=-30d | bucket _time span=1d |  stats count as events by source 

Basically, the bucket command will break your search results into specified time periods. In the search above we take the last month and break them into buckets per day.

Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...