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 for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

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