Splunk Search

Date validate to check before 8AM daily

splunk_hvijay
Explorer

Hi, Need your help on the below.

I want to validate a date/time to check if that time is before or after 8AM daily. For example, i want to validate the Timestamp column to check if its before/after 8AM on that day and need a new column "Result" like below

Timestamp Result
10/13/2016 03:45:00AM Before 8AM
10/16/2016 7:59:00AM Before 8AM
10/23/2016 12:30:00PM After 8AM
10/21/2016 13:45:00PM After 8AM

Please help me on how to achieve this... Thanks in advance for you help.

Tags (3)
0 Karma

sundareshr
Legend

Try this

base search | eval ts=strftime(strptime(Timestamp, "%m/%d/%Y %-I:%M:%S%p"), "%H") | eval Result=if(ts<08, "Before 8AM", "After 8AM") | table Timestamp ts Result
0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to November Tech Talks, Office Hours, and Webinars!

&#x1f342; Fall into November with a fresh lineup of Community Office Hours, Tech Talks, and Webinars we’ve ...

Transform your security operations with Splunk Enterprise Security

Hi Splunk Community, Splunk Platform has set a great foundation for your security operations. With the ...

Splunk Admins and App Developers | Earn a $35 gift card!

Splunk, in collaboration with ESG (Enterprise Strategy Group) by TechTarget, is excited to announce a ...