Splunk Search

How to ignore certain events from past and do not include them in the new search

dearimranz
Engager

I have following data:

January 2013 (sample events)

field1:123abc field2:789xyz field3:567ghj

field1:dkd786 field2:cgu874 field3:1j7ut5

field1:i98udy field2:jfutid field3:4jfu76

February 2013 (sample events)

field1:99yekf field2:mkioie field3:34fvgh

field1:klou43 field2:ccxx45 field3:loaq56

field1:i98udy field2:jfutid field3:4jfu76 (exists in January 2013 / maybe before)

March 2013 (sample events)

field1:poph34 field2:cvt87q field3:45fgty

field1:klou43 field2:ccxx45 field3:loaq56 (exists in February 2013 / maybe before)

field1:nbty67 field2:23sxcr field3:oiu765

I have written some regexs to extract different fields and make reports out of it which works fine. However for some of the reports I have a requirement that if field1's value exists in the previous month(s) events, it should NOT show in the current month's report. The current month report should ONLY show the new fields.

Any ideas how to accomplish this. Many thanks in advance.

Tags (2)
0 Karma

somesoni2
Revered Legend

Try following. This will first get list of all the months in which a particular combination of field1, field2, field3 occurs. If count of months for a combination is more than 1, it will be excluded. Also, if there are only one month, month value should match with current month, else it will be excluded too.

...... |stats values(date_month) as months by field1, field2, field3 | where mvcount(months)=1 AND isnotnull(mvfind(months,lower(strftime(now(),"%B"))))
0 Karma

aholzer
Motivator

Try "... | dedup field1 sortby _time". It'll remove duplicates giving you the earliest occurrence of the value in the field

0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...