Splunk Search

unable to all the display values if a condition is met

sukundur
Engager

Hi Everyone

I am trying to display the status of all the servers even if one one server status is OUT. like below.

server1 IN
server2 IN
server3 OUT
server4 IN

I an getting it without a condition but if I add a where clause... its giving me only the server which is out.

I am not able to schedule a alert for this.

index=app_ops_prod host=server* sourcetype="access" "/open/Alive.jsp" | stats latest(fr_status) as lt_status by host | eval server_status=if(match(lt_status,"404"),"OUT", "IN") | where server_status="OUT" | table host,server_status

my goal is to schedule a alert and display the status of all the servers even if one server status is OUT.

please advise.

Tags (2)
0 Karma
1 Solution

niketn
Legend

@sukundur, take out the following filter from your Alert search query.

 | where server_status="OUT"

And then Set custom Trigger Action i.e.

Trigger Condition:
Custom: "search server_status="OUT" 

Refer to Splunk Documentation on Custom Trigger Condition Example

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

View solution in original post

0 Karma

niketn
Legend

@sukundur, take out the following filter from your Alert search query.

 | where server_status="OUT"

And then Set custom Trigger Action i.e.

Trigger Condition:
Custom: "search server_status="OUT" 

Refer to Splunk Documentation on Custom Trigger Condition Example

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

sukundur
Engager

it worked . niketliay. thank you so much

0 Karma

sukundur
Engager

I tried this option and not sure why this alert is not triggering.

0 Karma

niketn
Legend

How about running this query first for the same time-range as your search

index=app_ops_prod host=server* sourcetype="access" "/open/Alive.jsp" 
| stats latest(fr_status) as lt_status by host 
| eval server_status=if(match(lt_status,"404"),"OUT", "IN") 
| table host,server_status

Ans then test whether search filter is working or not

index=app_ops_prod host=server* sourcetype="access" "/open/Alive.jsp" 
| stats latest(fr_status) as lt_status by host 
| eval server_status=if(match(lt_status,"404"),"OUT", "IN") 
| table host,server_status
| search server_status="OUT" 
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...