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
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

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