Splunk Search

How to change a span of 1 week time to start from Monday to friday

syedabuthahir
Explorer
How to change a span of 1 week time to start from Monday to friday
 
usually span=1w it will show data from monday 00:00 hrs to Sunday 23.59 hrs
 
Can someone help on this query 
 
Thanks in Advance
Labels (1)
Tags (1)
0 Karma

syedabuthahir
Explorer

@yuanliu  can i have the search query

 

0 Karma

yuanliu
SplunkTrust
SplunkTrust

This is an example. My data comes in once a week on Sunday.  But sometimes it comes late by a day or two.  I want to plot data by week:

| eval _time = _time + 5 * 86400
| timechart span=1w@w count

 Here, positive or negative offset is chosen based on how I want to date label to show on the time axis.

0 Karma

aasabatini
Motivator

Hi @syedabuthahir  

try this:

 sourcetype=foo
| eval date_hour=strftime(_time, "%H") | eval date_wday = strftime(_time, "%w")
| search date_hour>=0 date_hour<=23 date_wday>=1 date_wday<=5
“The answer is out there, Neo, and it’s looking for you, and it will find you if you want it to.”
0 Karma

yuanliu
SplunkTrust
SplunkTrust

When I need to fudge week, I add or subtract days from _time.

0 Karma
Get Updates on the Splunk Community!

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...

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

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