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!

Accelerating Observability as Code with the Splunk AI Assistant

We’ve seen in previous posts what Observability as Code (OaC) is and how it’s now essential for managing ...

Integrating Splunk Search API and Quarto to Create Reproducible Investigation ...

 Splunk is More Than Just the Web Console For Digital Forensics and Incident Response (DFIR) practitioners, ...

Congratulations to the 2025-2026 SplunkTrust!

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