Splunk Search

Is there a dedup command to remove events that have same timestamp?

mlm
Explorer

hello guys,

Is there any way that I could remove duplicate events that have same timestamp using this below search string:

 

index=* (EventCode=4624 OR EventCode=4625)
| stats count(Keywords) as Attempts, count(eval(match(Keywords,"Audit Failure"))) as Failed,
count(eval(match(Keywords,"Audit Success"))) as Success
earliest(_time) as FirstAttempt latest(_time) as LatestAttempt by Account_Name
| where Attempts>=5 AND Success>=1 AND Failed>=2
| eval FirstAttempt=strftime(FirstAttempt,"%x %X")
| eval LatestAttempt=strftime(LatestAttempt,"%x %X")

 



The output:

Account_Name Attempts Failed Success FirstAttempt LatestAttempt

 

 

Labels (3)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
index=* (EventCode=4624 OR EventCode=4625)
| dedup _time
| stats count(Keywords) as Attempts, count(eval(match(Keywords,"Audit Failure"))) as Failed,
count(eval(match(Keywords,"Audit Success"))) as Success
earliest(_time) as FirstAttempt latest(_time) as LatestAttempt by Account_Name
| where Attempts>=5 AND Success>=1 AND Failed>=2
| eval FirstAttempt=strftime(FirstAttempt,"%x %X")
| eval LatestAttempt=strftime(LatestAttempt,"%x %X")
0 Karma

mlm
Explorer

hey @ITWhisperer thanks for the reply. unfortunately, it didn't work - it is giving me a "no result found"

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

The dedup worked, the issue is that probably the events needed to complete the rest of the query have probably been removed. You will need to be more precise about which events you want to remove.

0 Karma

mlm
Explorer

yeah, so basically, i want to monitor user account's event 4624 & 4625 by attempts, the problem is that there are bunch of duplicate events with same timestamp so i want to remove those and have a unique count

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

You could try

 

| dedup _time EventCode

or

| dedup _time EventCode Account_Name

 

mlm
Explorer

Awesome!! This one actually works! Thank you so much sir!

0 Karma
Get Updates on the Splunk Community!

Splunk AI Assistant for SPL | Key Use Cases to Unlock the Power of SPL

Splunk AI Assistant for SPL | Key Use Cases to Unlock the Power of SPL  The Splunk AI Assistant for SPL ...

Buttercup Games: Further Dashboarding Techniques (Part 5)

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...

Customers Increasingly Choose Splunk for Observability

For the second year in a row, Splunk was recognized as a Leader in the 2024 Gartner® Magic Quadrant™ for ...