Splunk Search

Time filtering

jerinvarghese
Communicator

Current code that am using is below

 index=opennms "uei.opennms.org/nodes/nodeUp" OR "uei.opennms.org/nodes/nodeDown" AND "AOKBT-WANRTC002"
  | eval Time_CST=_time
  | sort Time_CST
  | delta Time_CST as duration
  | eval duration=tostring(round(duration),"duration")
  | fieldformat Time_CST=strftime(Time_CST,"%x %X")
  | rex field=eventuei "(?<Status>[A-Z].*)"
  | dedup nodelabel sortby - Time_CST 
  | table nodelabel, duration, Status, Time_CST

Output is...

nodelabel   duration    Status  Time_CST
USDALIGW    00:15:59    Up  03/24/20 03:47:15
USRG2   00:01:46    Up  03/24/20 02:05:44
USBRP   00:01:40    Up  03/23/20 16:49:27

If i keep it for all devices, I used to get duration for 1 min also.. please help me filter or remove all those below 15 mins. I want to display only those devices with duration above 15 mins.
please help me

0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust
...
| delta Time_CST as duration
| where duration > 900
| eval duration=tostring(round(duration),"duration")
...
---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust
...
| delta Time_CST as duration
| where duration > 900
| eval duration=tostring(round(duration),"duration")
...
---
If this reply helps you, Karma would be appreciated.

jerinvarghese
Communicator

I have one more issue which am facing.

index=opennms "uei.opennms.org/nodes/nodeUp" OR "uei.opennms.org/nodes/nodeDown" "WANRT*"
| rex field=eventuei "uei.opennms.org/nodes/node(?<bgpPeerState>.+)"
| eval Status=case(bgpPeerState=="Up", "UP", bgpPeerState=="Down", "DOWN", 1=1, "Other")
 | rename _time as Time_CST
  | fieldformat Time_CST=strftime(Time_CST,"%x %X")
| dedup nodelabel sortby - Time_CST 
| table nodelabel Status  Time_CST

Output:

nodelabel   Status  Time_CST
NZSKB   DOWN    03/24/20 10:33:33
GQPCW   DOWN    03/24/20 10:30:15
EGSUM   UP  03/24/20 10:19:39
GQHAN   DOWN    03/24/20 10:16:57
FJVUD   UP  03/24/20 10:05:20
PGPKC   UP  03/24/20 09:58:09

is it possible to only display DOWN CASES in the dashboard

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Separate issues should be separate questions. This answer is similar to the first.

...
| eval Status=case(bgpPeerState=="Up", "UP", bgpPeerState=="Down", "DOWN", 1=1, "Other")
| where Status=="DOWN"
| rename _time as Time_CST
...
---
If this reply helps you, Karma would be appreciated.
0 Karma

jerinvarghese
Communicator

that converted all the UP s to DOWN.

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!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...