Splunk Search

Splunk Search: index all weekends

angelo82
Explorer

Good Morning I'm looking for collect in Splunk Search all weekends logs

i've done this one:

'sourcetype="WinEventLog:Security" earliest=@w6 latest=@w1`

and it's good only for last weekend

what should i do to collect this time range for all weekends?

i'm using Splunk 4.3.3

My Thanks in Advance

Tags (4)
0 Karma
1 Solution

Ayn
Legend

Extract the week day from the timestamp, then check events that match your conditions. Something like this:

... | eval date_wday=strftime(_time,"%a") | search date_wday="Sat" OR date_wday="Sun"

Note: the date_wday field is most often created automatically by Splunk, so if you're seeing that all your events already have this, you don't need to create it yourself using eval like what I did above. However there are situations when it will not be created, so make sure first that you're not encountering that problem.

View solution in original post

Ayn
Legend

Extract the week day from the timestamp, then check events that match your conditions. Something like this:

... | eval date_wday=strftime(_time,"%a") | search date_wday="Sat" OR date_wday="Sun"

Note: the date_wday field is most often created automatically by Splunk, so if you're seeing that all your events already have this, you don't need to create it yourself using eval like what I did above. However there are situations when it will not be created, so make sure first that you're not encountering that problem.

angelo82
Explorer

it runs perfetcly, your string is that i need

thank you very much
regards
Angelo

0 Karma
Get Updates on the Splunk Community!

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

Introducing the 2024 SplunkTrust!

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