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!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...