Splunk Search

How to edit my search to sort the count to only show hosts that have not been seen over 2 hours?

SecurityIsMyMid
Explorer

I'm trying to sort an hour search with:

eval mydiff=tostring(info_search_time-orig_time, "duration") | table orig_host,lastTime,mydiff | rename orig_host AS "Hostname", lastTime AS "Last Time Seen", mydiff AS "Days Not Seen" 

How do I sort the count to only show hosts that haven't been seen over 2 hours?

Thanks

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Something like this should get you started.

eval mydiff=tostring(info_search_time-orig_time, "duration") | where lastTime < relative_time(now(),"-2h") | table orig_host,lastTime,mydiff | rename orig_host AS "Hostname", lastTime AS "Last Time Seen", mydiff AS "Days Not Seen" 
---
If this reply helps you, Karma would be appreciated.
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 ...