Splunk Search

Getting rid of subsearch

cpeteman
Contributor

I feel like this should be a piece of cake with distinct count. I'd like to turn this into a more elegant search:

 searchterms | bucket _time span=1m | stats count by punct,_time |  join [searchterms | stats count by punct| stats sum(count) by punct]

It gets the count of each punct in a given minute along with the total count for that punct over the entire search range.

0 Karma
1 Solution

lguinn2
Legend

Try this

yoursearchhere
| bucket _time span=1m
| stats count as CountForMinute by punct, _time
| eventstats sum(CountForMinute) as CountForPunct by punct

View solution in original post

0 Karma

lguinn2
Legend

Try this

yoursearchhere
| bucket _time span=1m
| stats count as CountForMinute by punct, _time
| eventstats sum(CountForMinute) as CountForPunct by punct
0 Karma

cpeteman
Contributor

That makes more sense it looks to work now.

0 Karma

lguinn2
Legend

I fixed my typo - so the above answer should work now. I was being cute by giving names to the counts, and I outsmarted myself...

cpeteman
Contributor

This only gives Count for minute strangely it does not seem that eventstats is doing anything

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!

Agent Mode Engaged! Enchaining Agentic Operations with Splunk AI Assistant 2.0

    Are you ready to transform how your team handles complex data requests? We invite you to our upcoming ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...