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!

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 ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...