Splunk Search

how to identify how many times that same timestamp is occured .....

dilstn
Explorer

I have logs in which some events occured twice in same timestamp.......so i need to identify and eliminate those repeated timestamp alone.... I found that with dedup it provide once occurence of timestamp... but i need to eliminated repeated timestamps alone .....

For example .,,,.. these are the fields obtained by using regex ...Fields--> Date & CountryCode

Date CountryCode
Mar 28, 2013 5:42:30 AM AUS
Mar 28, 2013 5:42:30 AM AUS
Mar 28, 2013 5:50:21 AM PAK
Mar 28, 2013 5:57:14 AM USA
Mar 28, 2013 5:59:45 AM SGP
. .
. .
. .

So here i need to eliminate repeated timestamp... here the first two field values are repeated....
So it must be eliminated......

The result should be like this......

Date CountryCode

Mar 28, 2013 5:50:21 AM PAK
Mar 28, 2013 5:57:14 AM USA
Mar 28, 2013 5:59:45 AM SGP
.

So the repeated timestamp should be avoided .... Can u guide me .....plz...............

Tags (1)
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

So... you want to drop any row where the timestamp occurs more than once? Try this:

... | eventstats count by _time | where count=1

View solution in original post

0 Karma

BobM
Builder

Splunk has a dedup command to remove duplicates. You just mention the fields to compare and it will keep only the first it detects.

... | dedup Date, CountryCode

Bob

0 Karma

kristian_kolb
Ultra Champion

So you want to remove all of the results for the duplicated events, not just the extras, right?

Assuming there are fields called Date and CountryCode;

...| stats c(CountryCode) as count first(CountryCode) as CountryCode by Date | where count < 2 | fields - count

/K

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

So... you want to drop any row where the timestamp occurs more than once? Try this:

... | eventstats count by _time | where count=1
0 Karma

dilstn
Explorer

you are really rocking man !!! . It worked finally ...thank U

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

If that's what he wants he can do an eventstats count by _time CountryCode to eliminate that risk.

0 Karma

kristian_kolb
Ultra Champion

there's a risk that two events with different CountryCodes may happen in the same second..

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...