Splunk Search

Data frequency for all index and sourcetype.

arjit
Path Finder

Hi All,  I was looking for a query which can look for the previous one month data, calculate frequency of data being coming to indexer and sourcetype (data is not real time and for eg. say we are getting data into index and sourcetype after . 5 hours or so) and return average (as frequency will differ every time say sometime 5 hours or sometimes 4 hours). For example. Indexer A and sourcetype B are receiving data every 5 hour on an average within a day. Can somebody please help in this regards? Thanks.

Labels (6)
0 Karma
1 Solution

tscroggins
Influencer

The monitoring console provides examples for working with license usage data (Indexing > License Usage > Historic License Usage). You can adapt those searches to your needs.

The average interarrival time is just the inverse of the arrival rate, so we can use e.g. the sum of the bytes indexed every 24 hours to find the average time in hours between bytes. Adapted from the monitoring console:

index=_internal source=*license_usage.log* type=Usage earliest=-1mon@mon latest=@mon
| eval h=if(((len(h) == 0) OR isnull(h)),"(SQUASHED)",h) 
| eval s=if(((len(s) == 0) OR isnull(s)),"(SQUASHED)",s) 
| eval idx=if(((len(idx) == 0) OR isnull(idx)),"(UNKNOWN)",idx) 
| bin _time span=1d 
| stats sum(b) as b by _time st idx
| stats avg(eval(1/(b/24))) as avg_interarrival_time_in_hours by _time idx st

 

View solution in original post

arjit
Path Finder

Thanks @tscroggins ! I will look into them...

0 Karma

tscroggins
Influencer

The monitoring console provides examples for working with license usage data (Indexing > License Usage > Historic License Usage). You can adapt those searches to your needs.

The average interarrival time is just the inverse of the arrival rate, so we can use e.g. the sum of the bytes indexed every 24 hours to find the average time in hours between bytes. Adapted from the monitoring console:

index=_internal source=*license_usage.log* type=Usage earliest=-1mon@mon latest=@mon
| eval h=if(((len(h) == 0) OR isnull(h)),"(SQUASHED)",h) 
| eval s=if(((len(s) == 0) OR isnull(s)),"(SQUASHED)",s) 
| eval idx=if(((len(idx) == 0) OR isnull(idx)),"(UNKNOWN)",idx) 
| bin _time span=1d 
| stats sum(b) as b by _time st idx
| stats avg(eval(1/(b/24))) as avg_interarrival_time_in_hours by _time idx st

 

Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...