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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...