Reporting

Change report sending time logic

AdrianMCZ
Explorer

I have a report where it counts the events for the "next weekend", this meaning the following:

1.“Weekend” is considered the interval between Friday - 4 pm and Monday - 8 am.

2.: “Next” is to be considered with this rule: from Monday to Thursday, is the coming week and from Friday to Sunday, is the weekend after the next one.

Example: before June, Friday 4th, the interval 4/6 - 7/6 is considered the next weekend, on Friday 4th the interval 4/6 - 7/6 becomes this weekend , 11/6 – 14/6 becomes next weekend.

Issue: The report is scheduled at 8AM each day, but the Friday one is not considering the upcoming weekend as the "next weekend", rather taking the future weekend which will take place in 7 days.

I need help in understanding how to change the logic of this report, to have it also on Friday filled with the next weekend results, meaning the first and second day right after. Hope it makes sense.

 

| eval start = strptime( 'Scheduled Start' ,"%Y-%m-%d %H:%M") 
| eval end = strptime( 'Scheduled End' ,"%Y-%m-%d %H:%M") 
| eval "Scheduled Start" = strftime(start , "%Y-%m-%d %H:%M") 
| eval "Scheduled End" = strftime(end , "%Y-%m-%d %H:%M") 
| eval nextFriday =if( strftime(now(),"%w")=="5" OR strftime(now(),"%w")=="6" OR strftime(now(),"%w")=="0",relative_time(now() , "+1w@w5+16h"), relative_time(now() , "@w5+7d+16h"))  
| eval nextMonday = relative_time(nextFriday , "+3d@d+8h") 
| eval nextMondayS = strftime(nextMonday , "%Y-%m-%d %H:%M") 
| eval nextFridayS1 = strftime(nextFriday , "%Y-%m-%d %H:%M") 
| where start >= nextFriday AND start <= nextMonday 

 

 

 

Labels (2)
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 ...