Splunk Search

Average of count per second

vinraisf
New Member

I am trying to get average per second while using this query

Source= (logRecordType="V" OR logRecordType="U") earliest=2/25/2014:22:00:00 latest=2/25/2014:22:02:00 | stats count by logRecordType

I would like to get the average per second using this formula

(latest-earliest)= 2 minute = 120 seconds

Then if my Count for logRecordType="V" is 240 then it should be 2 = 240/120
And if my count for logRecordType="U" is 360 then it should be 3 = 360/120

Tags (1)
0 Karma
1 Solution

somesoni2
Revered Legend

try this

source=abc (logRecordType="V" OR logRecordType="U") earliest=2/25/2014:22:00:00 latest=2/25/2014:22:02:00 | addinfo | eval totalSecs=info_max_time - info_min_time | stats count by logRecordType, totalSecs | eval Avg=round(count/totalSecs,2) | table logRecordType, Avg

View solution in original post

kristian_kolb
Ultra Champion

Welcome to the forum vinraisf. If an answer to your question solves your problem, please mark the question as answered by ticking the check mark next to the correct answer. (like I did for you here)

You can also vote answers up or down if they were particularly helpful.

Happy Splunking,

K

0 Karma

vinraisf
New Member

That worked like a charm, thank you so much someson12! I really appreciate it.

0 Karma

somesoni2
Revered Legend

try this

source=abc (logRecordType="V" OR logRecordType="U") earliest=2/25/2014:22:00:00 latest=2/25/2014:22:02:00 | addinfo | eval totalSecs=info_max_time - info_min_time | stats count by logRecordType, totalSecs | eval Avg=round(count/totalSecs,2) | table logRecordType, Avg
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...