Splunk Search

Function To Return Last Weekday?

andrewkenth
Communicator

Is there a function to return the last weekday?

Instead of:

relative_time(now(), "-1d@d") 

Is there any notation to say workday or weekday?

Tags (2)
0 Karma
1 Solution

andrewkenth
Communicator

That did not seem to work. Instead I used a case to check the day of the week:

| where Date > case(strftime(now(),"%w")="1", relative_time(now(), "-3d@d"), strftime(now(),"%w")!="1", relative_time(now(), "-1d@d"))

View solution in original post

0 Karma

andrewkenth
Communicator

That did not seem to work. Instead I used a case to check the day of the week:

| where Date > case(strftime(now(),"%w")="1", relative_time(now(), "-3d@d"), strftime(now(),"%w")!="1", relative_time(now(), "-1d@d"))

0 Karma

linu1988
Champion

@w-1d would take

0 Karma

somesoni2
Revered Legend
0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...