Splunk Search

Filter events based on date that is currently a string?

craigbar
New Member

I am trying to filter results based on relative date (last 6 months). Splunk extracted the field I would like to use as a string. Here is an example: Computer Last Seen = "Mon Jun 01 20:26:49 EDT 2015". I have been attempting to use eval strptime to get create a field while searching. It is not working.

Can anyone suggest a better approach?
Thanks.

Tags (2)
0 Karma

woodcock
Esteemed Legend

Assuming the field that Splunk extracted is called Computer_Last_Seen, try this (15552000=6 months in seconds):

... | lastSeenTimeEpoch = strptime(Computer_Last_Seen, "%a %b %d %H:%M:%S %Z %Y") | eval AgeSeconds = now() - lastSeenTimeEpoch | where AgeSeconds < 15552000
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 ...