Splunk Search

is their way alert(search query) can distinguish between weekdays, weekends, monthend?

rsathish47
Contributor

hi All,

is their way alert(search query) can distinguish between weekdays, weekends, monthend?

Thanks
Sathish R

Tags (1)
0 Karma

woodcock
Esteemed Legend

Like this:

... | eval now=now() | eval date_wday=strftime(now, "%a") | eval weekday=if(date_wday="Sat" OR date_wday="Sun","NO","YES") | eval  date_mday=strftime(now, "%d") | eval tomorrow=now+86400 | date_mday_tomorrow=strftime(tomorrow, "%d") | eval monthend = if(date_mday>date_mdate_tomorrow,"YES","NO") | fields weekday monthend
0 Karma
Get Updates on the Splunk Community!

Shape the Future of Splunk: Join the Product Research Lab!

Join the Splunk Product Research Lab and connect with us in the Slack channel #product-research-lab to get ...

Auto-Injector for Everything Else: Making OpenTelemetry Truly Universal

You might have seen Splunk’s recent announcement about donating the OpenTelemetry Injector to the ...

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...