Splunk Search

I'm using timechart to produce two rows for two blocks of time, how can I do a count on only row 2 and not row 1?

jospina2
Explorer

Hello,
I set up an alert to search for an error message that appears in one my windows application. Time-wise I set it up to search the last 10 minutes only.

SourceName="My Web Client" Message="My Error Message" earliest=-11m@m latest=-1m@m
| timechart span=5m count values() BY source

Which produces this result (see image) :

alt text

This almost works for what I want. But, I want this to trigger an email to me only if the second row's count is = 0. Right now it alerts regardless of any number, including 0.

How do I declare that row2's count must be 0? row1 is allowed to be any count number it wants, but row2 must be 0, otherwise I do not want the alert to trigger.

Thanks,
Jeff

0 Karma

somesoni2
Revered Legend

Try this

SourceName="My Web Client" Message="My Error Message" earliest=-11m@m latest=-1m@m 
| timechart span=5m count values() BY source
| eventstats list(count*) as list* | eval shouldAlert="No"
| foreach list* [| eval shouldAlert=if(mvindex('<<FIELD>>',1)==0,"Yes",shouldAlert) ]
| where shouldAlert="Yes"
0 Karma

jospina2
Explorer

Hello,

Line 3 was hepful, but line 4 causes this error:

Error in 'eval' command: Typechecking failed. The '==' operator received different types

0 Karma
Get Updates on the Splunk Community!

Ready, Set, SOAR: How Utility Apps Can Up Level Your Playbooks!

 WATCH NOW Powering your capabilities has never been so easy with ready-made Splunk® SOAR Utility Apps. Parse ...

DevSecOps: Why You Should Care and How To Get Started

 WATCH NOW In this Tech Talk we will talk about what people mean by DevSecOps and deep dive into the different ...

Introducing Ingest Actions: Filter, Mask, Route, Repeat

WATCH NOW Ingest Actions (IA) is the best new way to easily filter, mask and route your data in Splunk® ...