Getting Data In

How to see if two different hosts have failure event records?

riotto
Path Finder

I need to return a "yes"
if (host=A has events > 0 and host=B has events > 0)
else '"no"

Tags (2)
0 Karma

riotto
Path Finder

sundareshr,

Won't that search give either host=A or host=B (...or maybe both) ? I need to return a "yes' when I have failure record from BOTH host=A and host=B

0 Karma

sundareshr
Legend

Try this

index=yourindex host=A OR host=B "failure" | stats count | eval result=if(count>0, "Yes", "No")
0 Karma

riotto
Path Finder

Won't that return a "yes" if either host A or host B returns an event?
I need when both host a and host b return an event

0 Karma

sundareshr
Legend

Ah!!! Try this

index=yourindex host=A OR host=B "failure" | stats dc(host) as hosts | eval result=if(hosts=2, "Yes", "No")
0 Karma

riotto
Path Finder

Yes I believe that will do it, you da man...Is there a way to pass the value of 'result' to a windows batchfile
that will be triggered to run when this alert runs?

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...