Alerting

And condition

Pravinsugi
Path Finder

I have below message in the splunk log

 

Ex : s1 event has been received for customer 15778

S2 event has been received for customer 15778

S3 event has been received for customer 15778

 

I want to check all S1,S2,S3 event has been received message present in the particular customer.i used AND condition but not able to achieve.plesse help me on this.

As per my scenario,if i have 1 lakhs customer, i want to check for all 3 events has been received mesage is present in the splunk log for one particular customer.if not present all 3 mesage i need to set up alert.

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Assuming customer and event have already been extracted

| stats values(event) as events by customer
| where NOT (events = "s1" AND events = "s2" AND events = "s3")
0 Karma

Pravinsugi
Path Finder

How to extract customer number ?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| rex "customer (?<customer>\d+)"
0 Karma

Pravinsugi
Path Finder

I have below query .how to include into result query.pls advise

 

 

Need to include this one into result query

| stats values(event) as events by customer | where NOT (events = "s1" AND events = "s2" AND events = "s3")

Result query:

(index=1 sourcetype="abc" "s1 event received" and "s2 event received" and "s3 event received") OR (index=2 sourcetype="xyz" "created") | rex "(?<e_type>s.) event received for (?<customer>\d+)" | rex "(?<created>created) for (?<customer>\d+)" | stats max(eval(if(e_type="s3",_time, null()))) as last_e_type max(eval(if(created="created", _time, null()))) as created_time dc(e_type) as e_types values(created) as created by customer | addinfo | where e_types=3 AND (created_time-last_e_type > 300 OR (isnull(created_time) AND info_max_time - last_e_type > 300)

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

It depends on what you are trying to do since this search seems to be the opposite of what you had previously said you were trying to do.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

The AND operator works within a single event.  To combine multiple events you need to use an aggregating command.  Assuming the customer number has been extracted into a field called "customer" then this will trigger an alert if any customer does not have all three events.

<<some search for S1, S2, and S3>>
| stats count by customer
| where count < 3

 

---
If this reply helps you, Karma would be appreciated.
0 Karma

Pravinsugi
Path Finder

How to extract customer number from the event .pls advise 

0 Karma
Get Updates on the Splunk Community!

Enter the Splunk Community Dashboard Challenge for Your Chance to Win!

The Splunk Community Dashboard Challenge is underway! This is your chance to showcase your skills in creating ...

.conf24 | Session Scheduler is Live!!

.conf24 is happening June 11 - 14 in Las Vegas, and we are thrilled to announce that the conference catalog ...

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...