Splunk Search

trigger an alert if a process is taking more than the expected time

kranthimutyala
Path Finder

Hi Splunkers,

I have the below logs and trying to create an alert if a process run is taking more than the expected time.

2021-03-24T14:00:14.8 STATUS=Successful,ACTIVITY AT=2021-03-24T14:00:14,ACTION TYPE=Process started

2021-03-24T14:05:21.54 STATUS=Successful,ACTIVITY AT=2021-03-24T14:05:21,TYPE=Process finished

Im using the below query to track the same but it is triggering an alert even if the process is completed well within the limit

index="abc" TYPE="Process started"
| eval last_seen=_time
| eval mins_since = round((now() - last_seen) / (60))
|table mins_since |search mins_since>10

From the above logs the alert shouldn't trigger since process has finished in 5mins but i'm getting false positives.The alert should trigger only if Process is not finished and mins_since>10.

I tried search TYPE!="Process finished" AND mins_since>10 but still not getting desired results.Please help me in this scenario.Thanks.

 

 

0 Karma
1 Solution

scelikok
SplunkTrust
SplunkTrust

Hi @kranthimutyala,

Since you are not checking if Process finished or not  result may wrong. Please try this.

index="abc" TYPE="Process started"
| dedup TYPE | head 1
| eval mins_since = round((now() - _time) / 60)
| where TYPE="Process started" AND mins_since>10
| table min_since
If this reply helps you an upvote and "Accept as Solution" is appreciated.

View solution in original post

0 Karma

scelikok
SplunkTrust
SplunkTrust

Hi @kranthimutyala,

Since you are not checking if Process finished or not  result may wrong. Please try this.

index="abc" TYPE="Process started"
| dedup TYPE | head 1
| eval mins_since = round((now() - _time) / 60)
| where TYPE="Process started" AND mins_since>10
| table min_since
If this reply helps you an upvote and "Accept as Solution" is appreciated.
0 Karma
Get Updates on the Splunk Community!

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...