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!

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...