Splunk Search

Deduping one field for each of another field

0cool
New Member

I'm looking for a way to dedup a given field for each instance of another field. More specifically:

| eval warningIssued=if(transtype="Show Page" AND failed_policy="OS Patches - Download and Install::OS Patches NOT set to Automatic", 1, 0) | eval nowCompliant=if(compliant_policy="OS Patches - Download and Install::OS Patches set to Automatic",1,0) |

Following this string, I would like to get rid of everything but the earliest event where warningIssued=1 for EACH MAC address, and the earliest event where nowCompliant=1 for EACH MAC address. Is there any way to dedup this way?

Tags (1)
0 Karma

kristian_kolb
Ultra Champion

I think this could work.

your_search |  search warningIssued=1 OR nowCompliant=1 | reverse | dedup MAC warningIssued nowCompliant | whatever_comes_next

but it will be rather slow, since reverse will not make splunk search oldest-first, it just re-sorts the events once they are all in. If you have a large number of events, or a long time span, this can be quite prohibitive.

The dedup will find the (chronologically, since events are resorted) first unique combinations of MAC, warningIssued and nowCompliant.

This assumes that these fields are present in the events. You might have to add keepempty=true to the dedup command, depending on whether all three fields are always present in an event or not. Also I might have misunderstood the documentation.

Hope this helps,

Kristian

0 Karma
Get Updates on the Splunk Community!

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 ...

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...