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!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...