Splunk Search

How to trigger an alert if there is no event2 within 30 minutes of event1?

kiran331
Builder

Hi all,

I have to trigger an alert for event=1, if there is no event=2 within 30min of event=1. Search I'm using:

index="abc" (EVENT=1 OR EVENT=2)| transaction MACHINE startswith=(EVENT=1) endswith=(EVENT=2)|where duration> 1800 | table  duration  EVENT MACHINE NAME DESCR

It's working only if have an event=2. What is best the best way to achieve it?

0 Karma
1 Solution

somesoni2
Revered Legend

Try this

index="abc" (EVENT=1 OR EVENT=2)| transaction MACHINE startswith=(EVENT=1) endswith=(EVENT=2) keepevicted=t |where duration> 1800 OR ( mvcount(EVENT)=1 AND EVENT=1)| table duration EVENT MACHINE NAME DESCR

View solution in original post

somesoni2
Revered Legend

Try this

index="abc" (EVENT=1 OR EVENT=2)| transaction MACHINE startswith=(EVENT=1) endswith=(EVENT=2) keepevicted=t |where duration> 1800 OR ( mvcount(EVENT)=1 AND EVENT=1)| table duration EVENT MACHINE NAME DESCR

kiran331
Builder

Can you let me know how mvcount is working here, and if i schedule this alert to run every 5 min it will trigger when there is no event=2 within 1800s right?

0 Karma

diogofgm
SplunkTrust
SplunkTrust

mvcount is counting the number of values in a multivalued field

You can check more info here

------------
Hope I was able to help you. If so, some karma would be appreciated.
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

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

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...