Splunk Search

How to join my two searches to monitor a combination of two status fields for a rangemap condition?

splunker9999
Path Finder

Hi Splunkers,

We are looking to join 2 searches in getting a single point result.

Currently we have a search which gives UP and Down status. When a server is UP, it turns to green, and if down, it turns RED. Below is the search.

This search takes the latest event and gives us the result (Up/Down) based on status. If we don't have any latest event, by default it is UP.

index=f5 server1  monitor status fillnull value="up" F5_TCPStatus | eval status=if(F5_MonitorStatus="monitor status up" OR F5_MonitorStatus="monitor status enabled" ,10,0)|head 1 |appendpipe [ stats count | eval status=10 | where count==0 | fields - count ] | stats values(status) AS severity| rangemap field=severity severe=0-9 low=10-11 default=elevated

Now current scenario is, we have 2 more statuses added up to field "MonitorStatus"
1. Monitor Status Enabled
2. Monitor Status Disabled.
These statuses occur when server administrators disable any server during a maintenance window.

Scenario 1: If we will filter head 1 events with status "up" and head 1 events with status "Disable", then we need to turn the symbol to RED.

This gives us UP/down status for head 1 event:

index=f5 server1  monitor status fillnull value="up" F5_TCPStatus | eval status=if(F5_MonitorStatus="monitor status up" ,10,0)|head 1 |appendpipe [ stats count | eval status=10 | where count==0 | fields - count ] | stats values(status) AS severity| rangemap field=severity severe=0-9 low=10-11 default=elevated

This gives head 1 event of Enable/Disable status:

index=f5 server1  monitor status disabled fillnull value="enabled" F5_TCPStatus | eval status=if(F5_MonitorStatus="monitor status enabled"  ,10,0)|head 1 |appendpipe [ stats count | eval status=10 | where count==0 | fields - count ] | stats values(status) AS severity| rangemap field=severity severe=0-9 low=10-11 default=elevated

We need to combine these 2 searches such that it needs to check both search events and it should satisfy below conditions to be GREEN OR RED

COlor:       Status1       status 2
Green        UP            ENABLE
RED          UP            Disable
RED          DOWN          ENABLE
RED          DOWN          DISABLE
0 Karma
1 Solution

somesoni2
Revered Legend

Try this

iindex=f5 server1  monitor status fillnull value="up" F5_TCPStatus | eval status=if(F5_MonitorStatus="monitor status up" ,10,0)|head 1 |appendpipe [ stats count | eval status=10 | where count==0 | fields - count ] 
| append [search  index=f5 server1  monitor status disabled fillnull value="enabled" F5_TCPStatus | eval status=if(F5_MonitorStatus="monitor status enabled"  ,10,0)|head 1 |appendpipe [ stats count | eval status=10 | where count==0 | fields - count ] ] | stats sum(status) as severity  | rangemap field=severity severe=0-19 low=20-21 default=elevated

View solution in original post

0 Karma

somesoni2
Revered Legend

Try this

iindex=f5 server1  monitor status fillnull value="up" F5_TCPStatus | eval status=if(F5_MonitorStatus="monitor status up" ,10,0)|head 1 |appendpipe [ stats count | eval status=10 | where count==0 | fields - count ] 
| append [search  index=f5 server1  monitor status disabled fillnull value="enabled" F5_TCPStatus | eval status=if(F5_MonitorStatus="monitor status enabled"  ,10,0)|head 1 |appendpipe [ stats count | eval status=10 | where count==0 | fields - count ] ] | stats sum(status) as severity  | rangemap field=severity severe=0-19 low=20-21 default=elevated
0 Karma

splunker9999
Path Finder

Nice, This works good .Thank you.

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!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...