Splunk Search

How to get total for line count then subtotal for another field in the same query?

jaj
Path Finder

Hi - Very new to splunk.

I have the following query that gives me total count for a specific log:

LOGGING string:
"log msg: stuff="

from this query I can get total by matching "log msg":

source=*/logs/stdout.log classname=Log "log msg" | stats count

However, I want to get that count as well the count for "stuff" where stuff=""

How can I modify the query above to get the total count for "log msg" and total count where stuff is empty string...(as a next ask possibly display in a stacked bar chart?) But raw data is fine for now.

Tags (3)
0 Karma
1 Solution

somesoni2
Revered Legend

Try following

source=*/logs/stdout.log classname=Log "log msg" | stats count , count(eval(stuff=""))

View solution in original post

somesoni2
Revered Legend

Try following

source=*/logs/stdout.log classname=Log "log msg" | stats count , count(eval(stuff=""))

jaj
Path Finder

awesome, thanks!

0 Karma
Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...