Splunk Search

How to remove Duplicate values in different field?

alexspunkshell
Contributor

How to remove duplicate values in a different field

|stats count by src dest

alexspunkshell_0-1660244580972.png

 

Labels (3)
Tags (2)
0 Karma
1 Solution

yuanliu
SplunkTrust
SplunkTrust

The most straightforward implementation is

| stats count by src dest
| where src != dest

Alternatively,

| where src != dest
| stats count by src dest

 

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

Where are the duplicates?  I see the first 3 octets of some IP addresses match, but stats looks at the entire field, not just parts of it.  If you need to deduplicate on the first 3 octets, then use rex or split to extract it into a new field and dedup on that new field.

---
If this reply helps you, Karma would be appreciated.

alexspunkshell
Contributor

@richgalloway  Thanks for the reply

I am getting similar IPs in both src & dest fields.

So I want to remove in results if both src & dest are the same.

0 Karma

yuanliu
SplunkTrust
SplunkTrust

The most straightforward implementation is

| stats count by src dest
| where src != dest

Alternatively,

| where src != dest
| stats count by src dest

 

Taruchit
Contributor

Hi @alexspunkshell,

Please confirm if I understood your requirement correctly: -

There are two fields in the result: - src and dest.

If in a given row both src and dest are same, then you need to filter out those rows from the result.

Thank you

0 Karma

alexspunkshell
Contributor

@Taruchit  You are right.

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!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...