Splunk Search

How to filter the events by the date field?

kiran331
Builder

Hi

From the search, i get the event_date field. How can I filter the events by using the event_date field?

event_date
06/18/2014
06/20/2014
07/17/2014
...

I need the events only between 06/01/2014 - 06/31/2014. Any suggestions?

Tags (4)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

To compare dates you have to convert them into epoch form. Something like this

... | eval firstDate = strptime("06/01/2014", "%m/%d/%Y") | eval lastDate = strptime("06/30/2014", "%m/%d/%Y") | eval thisDate = strptime(event_date, "%m/%d/%Y") | where thisDate >= firstDate AND thisDate <= lastDate | ...
---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...