Splunk Search

How can I exclude a group of the mac address found at specific time?

jpjconti
Engager

I have a dataset with a lot of mac address captured. I would like to excluded all mac address that arrived between 0h until 6h. But these mac can still appear after 6h. For example:

DATE TIME MAC
01/01/2015 01:00:00 00:00:00:00:00:01
01/01/2015 03:00:00 00:00:00:00:00:01
01/01/2015 09:00:00 00:00:00:00:00:01
01/01/2015 10:00:00 00:00:00:00:00:02

As you can see above, just 00:00:00:00:02 mac wil should remain in dataset, because the other arrive between 0 until 6h.
How can I do the search?

Tags (1)
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

This isn't very pretty, but should work:

base search | eventstats min(date_hour) as min_date_hour by mac | where min_date_hour >= 6

This will look for the first occurrence of each mac, and only keep macs that didn't occur before 6am on any given day in the time range.

View solution in original post

somesoni2
Revered Legend

Do you search data for a single day OR multiple days?

0 Karma

jpjconti
Engager

Hello. Multiple days.

0 Karma

vasildavid
Path Finder

If I understand the question, you want to ignore events with MAC addresses that occurred between 0000-0600. You could probably do this with a subsearch that finds MAC addresses that had events during the time period 0-6h and then exclude those from your main search.

eventtype=mac_activity | where NOT [eventtype=mac_activity (date_hour>0 AND date_hour<6) | dedup mac | fields mac]
0 Karma

martin_mueller
SplunkTrust
SplunkTrust

This isn't very pretty, but should work:

base search | eventstats min(date_hour) as min_date_hour by mac | where min_date_hour >= 6

This will look for the first occurrence of each mac, and only keep macs that didn't occur before 6am on any given day in the time range.

jpjconti
Engager

Martin, thanks for your help. It worked.

0 Karma

Richfez
SplunkTrust
SplunkTrust

If this answered your question, could you mark this as Answered so people searching for it afterwards will know it was yet another wonderfully correct answer by the awesome martin_mueller?

Get Updates on the Splunk Community!

CX Day is Coming!

Customer Experience (CX) Day is on October 7th!! We're so excited to bring back another day full of wonderful ...

Strengthen Your Future: A Look Back at Splunk 10 Innovations and .conf25 Highlights!

The Big One: Splunk 10 is Here!  The moment many of you have been waiting for has arrived! We are thrilled to ...

Now Offering the AI Assistant Usage Dashboard in Cloud Monitoring Console

Today, we’re excited to announce the release of a brand new AI assistant usage dashboard in Cloud Monitoring ...