Splunk Search

Can you list time-unique events as one event if certain fields match?

d648777
New Member

Hi,

I'm a complete novice to Splunk, so forgive me if the following is basic/doesn't make sense. I'm trying to reduce noise in the extracted results of a search by identifying and matching data in fields from time-unique events and grouping them/ listing them as one event if the criteria matches (i.e. if (fieldA, fieldB, fieldC) are the same between dateTime1 and dateTime2 for event_a and event_b (or any additional events), then list/table as a single event).

Hoping someone can help or point me in the right direction.

Thanks!

0 Karma

vishaltaneja070
Motivator

Hello @d648777

I think you are talking about removing duplicate when you are running the search based on fields fieldA, fieldB and FieldC.

You can use dedup command to achieve this like <your_search> | dedup fieldA, fieldB, fieldC

0 Karma

d648777
New Member

Thanks for your answer! This is in the direction, but I'm trying to set a time-frame constraint in the sense that if fieldA, fieldB and fieldC are the same for event_a and event_ b in a 5 minute time period, list/table as one event; however, if fieldA, fieldB and fieldC are the same in event_a and event_b and the time difference between event_a and event_b is greater than 5 minutes, table them as separate events.

0 Karma

vishaltaneja070
Motivator

@d648777

Something like this can work for you:

    index=*  | eventstats latest(_time) as lat , earliest(_time) as ear | eval Diff= lat - ear +1  | search Diff > 300 
     |append [search index=*  | eventstats latest(_time) as lat , earliest(_time) as ear | eval Diff= lat - ear +1 |dedup fieldA, fieldB, fieldC | search Diff < 300]
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...