Splunk Search

How to remove third Thursday from Splunk results

blisowski
New Member

We would like to remove our monthly patching window from our error report that we receive from Splunk on some of our servers we report on. For example, we would like to be able to remove the data/error spike we get on the 3rd Thursday between the hours of 2pm-3pm during patching, and have this carry over into the next year, always the 3rd Thursday from 2-3pm removed from our data. In short, this would need to be a dynamic search, not specifically calling out dates.

We can't simply remove these errors themselves from the data, as every other day of the year we do want to see that information. Thoughts?

0 Karma

somesoni2
Revered Legend

Assuming your monthly report run on 2nd of every month, which runs on previous month, try like this

your base search for selecting last months data
| where NOT (_time>=relative_time(now(),"-1mon@mon+3w@w4+14h")  AND _time<relative_time(now(),"-1mon@mon+3w@w4+15h")  )

See this runanywhere sample on how those relative time calculates the third Thursday by month

| gentimes start=-12 | streamstats count | table count | eval month=strptime(count."/01/2019","%m/%d/%Y") | table month | eval thirdthu_start=relative_time(month,"@mon+3w@w4+14h")  | eval thirdthu_end=relative_time(month,"@mon+3w@w4+15h")| convert ctime(*) timeformat="%a %F %T"
0 Karma

efavreau
Motivator

Take caution with this approach. As soon as you slip a date, this query becomes unreliable. However, to answer your question:
Append this before your first | in your search:
NOT (date_wday=thursday AND date_hour=14 AND date_mday>14 AND date_mday<22)
This looks for a Thursday between the 14 and 22, which would always be the third Thursday, and selects events beginning 2pm. This covers from 2:00 pm - 2:59:59 pm. The NOT in front, says don't include these events.

###

If this reply helps you, an upvote would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...