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!

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

 Prepare to elevate your security operations with the powerful upgrade to Splunk Enterprise Security 8.x! This ...

Get Early Access to AI Playbook Authoring: Apply for the Alpha Private Preview ...

Passionate about security automation? Apply now to our AI Playbook Authoring Alpha private preview ...

Reduce and Transform Your Firewall Data with Splunk Data Management

Managing high-volume firewall data has always been a challenge. Noisy events and verbose traffic logs often ...