Splunk Search

Average alarms per reader over time

msage
Path Finder

A bit ago I submitted a question regarding how to get the average alarms per reader. So for example we have 100 alarms and 100 readers. That's on average 1 alarm per reader. With the help of the forum I got my answer but now I need to figure out how to get a trend of this search. I tried using a timechart but based on the way the search is built, it completely skews the results. Here's the search itself 

 

index="index" EVDESCR="EVDESCR"
| dedup EVENT_TIME
| bucket _time span=1d
| stats count by READERDESC
| stats sum(count) as sum_count
| eval result=sum_count / 220

 

Labels (3)
0 Karma
1 Solution

yuanliu
SplunkTrust
SplunkTrust

@msage You want to illustrate what timechart command you have tried and what is the difference between actual result and expected results so others can understand the intended use case.   The second stats  command in the search you illustrated negates the groupby in the first, and the time bucket  has  no effect.  The entire search can be collapsed as

 

index="index" EVDESCR="EVDESCR"
| dedup EVENT_TIME
| stats count as sum_count
| eval result=sum_count / 220

 

If I speculate your intentions based on the subject line and the illustrated search, you have  220 readers (not 100); you want a single average value, nothing grouped by READER_DESC.  This might be what you are asking for

 

index="index" EVDESCR="EVDESCR"
| dedup EVENT_TIME

| timechart span=1d count as average_alarms_per_reader
| eval average_alarms_per_reader = average_alarms_per_reader / 220

 

  Basically, count how many total alarms per day, and divide each count by  220.

View solution in original post

yuanliu
SplunkTrust
SplunkTrust

@msage You want to illustrate what timechart command you have tried and what is the difference between actual result and expected results so others can understand the intended use case.   The second stats  command in the search you illustrated negates the groupby in the first, and the time bucket  has  no effect.  The entire search can be collapsed as

 

index="index" EVDESCR="EVDESCR"
| dedup EVENT_TIME
| stats count as sum_count
| eval result=sum_count / 220

 

If I speculate your intentions based on the subject line and the illustrated search, you have  220 readers (not 100); you want a single average value, nothing grouped by READER_DESC.  This might be what you are asking for

 

index="index" EVDESCR="EVDESCR"
| dedup EVENT_TIME

| timechart span=1d count as average_alarms_per_reader
| eval average_alarms_per_reader = average_alarms_per_reader / 220

 

  Basically, count how many total alarms per day, and divide each count by  220.

msage
Path Finder

Hey @yuanliu basically what it was doing was getting the average of all the days by 220 rather than average of each day. However the search string you just provided seems to be the perfect solution for this.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Thanks for the Memories: .conf26 Took Learning to New Heights

Thank you, Splunk Community, for making .conf26 in Denver one for the books. From packed Splunk University ...

Best Practices: Splunk auto adjust pipeline queue

When you enable autoAdjustQueue in Splunk, maxSize should be understood as the queue size Splunk starts with ...

Splunk Auto Ingestion Parallel Pipeline Scaling

Why this feature matters Many Splunk environments experience ingestion pressure long before the host is fully ...