Splunk Search

How to get the number of events in a timechart query?

niroren
New Member

Hi,

I have a question about timechart query.
Lets say I have a log line like: "I found XXX matches"
How can I query and get - number of events of "I found" and number of the same events that XXX>0 in the same timechart
(i.e total number of events with the string and the number of events that I found something (XXX>0))

Thanks for your help,
Nir

0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Perhaps this will get you started.

index=foo | rex "I found (?<num>\d+) matches" | stats count as  Total count(eval(num>0)) as nonZero
---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Perhaps this will get you started.

index=foo | rex "I found (?<num>\d+) matches" | stats count as  Total count(eval(num>0)) as nonZero
---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Fueling your curiosity with new Splunk ILT and eLearning courses

At Splunk Education, we’re driven by curiosity—both ours and yours! That’s why we’re committed to delivering ...

Splunk AI Assistant for SPL 1.1.0 | Now Personalized to Your Environment for Greater ...

Splunk AI Assistant for SPL has transformed how users interact with Splunk, making it easier than ever to ...

Unleash Unified Security and Observability with Splunk Cloud Platform

     Now Available on Microsoft AzureOn Demand Now Step boldly into the AI revolution with enhanced security ...