Splunk Search

How to get upcoming friday date

vb1612
New Member

I have a date field in my feed as "2/15/2019" , want to compare this with upcoming friday date value in search.
please help how to do this

Tags (1)
0 Karma
1 Solution

renjith_nair
SplunkTrust
SplunkTrust

@vb1612,

To get next friday, you can use

|eval next_friday=relative_time(now(),"+1w@w5")

To get the difference ,

"your base search"
|eval give_date_in_epoch=strptime("2/15/2019","%m/%d/%Y")
|eval next_friday=relative_time(now(),"+1w@w5")
|eval diff=next_friday-give_date_in_epoch

Feel free to change the variable names.

Happy Splunking!

View solution in original post

renjith_nair
SplunkTrust
SplunkTrust

@vb1612,

To get next friday, you can use

|eval next_friday=relative_time(now(),"+1w@w5")

To get the difference ,

"your base search"
|eval give_date_in_epoch=strptime("2/15/2019","%m/%d/%Y")
|eval next_friday=relative_time(now(),"+1w@w5")
|eval diff=next_friday-give_date_in_epoch

Feel free to change the variable names.

Happy Splunking!
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...