All Apps and Add-ons

Comparing 2 events and respond with UP or DOWN state

jerinvarghese
Communicator

2019-12-18 03:05:53.999, eventid="357374258", eventuei="uei.opennms.org/thresholds/bgpPeerState/XOM-rearm", nodeid="726", eventtime="2019-12-18 03:05:53.999+00", ipaddr="158.55.2.109", eventlogmsg="Peering Lost Cleared in device: USBRO-WANRTC001, peer: 10.253.130.30", eventseverity="3", alarmid="19899391", nodelabel="USBRO-WANRTC001"

2019-12-18 02:58:54.041, eventid="357357158", eventuei="uei.opennms.org/thresholds/bgpPeerState/XOM-falling", nodeid="726", eventtime="2019-12-18 02:58:54.041+00", ipaddr="158.55.2.109", eventlogmsg="USBRO-WANRTC001: Peering Lost in device, peer: 10.253.130.30", eventseverity="7", alarmid="19899391", nodelabel="USBRO-WANRTC001"

I have the above 2 events from single index.

Eventuei is the comparison parameter here. Based on time it should compare.
This is a BGP peering status event from a device.

  based on time if only "uei.opennms.org/thresholds/bgpPeerState/XOM-falling" is there, It should show STATUS : DOWN.
     If "uei.opennms.org/thresholds/bgpPeerState/XOM-rearm" came after  "uei.opennms.org/thresholds/bgpPeerState/XOM-falling"  in terms of time STATUS : UP should show.
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

This can be done by setting a Status field based on the Eventuei value. Then dedup by nodeid (or another field unique to each device). The remaining events contain the last status of each device.

index=foo ("XOM-rearm" OR "XOM-failing") 
| eval Status=case(match(eventuei, "XOM-rearm"), "UP", match(eventuei, "XOM-failing"), "DOWN", 1==1, "unknown")
| dedup nodeid
| table nodeid Status
---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

This can be done by setting a Status field based on the Eventuei value. Then dedup by nodeid (or another field unique to each device). The remaining events contain the last status of each device.

index=foo ("XOM-rearm" OR "XOM-failing") 
| eval Status=case(match(eventuei, "XOM-rearm"), "UP", match(eventuei, "XOM-failing"), "DOWN", 1==1, "unknown")
| dedup nodeid
| table nodeid Status
---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

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 ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...