Splunk Search

Help with search query to table single occurrence rows?

rsathish47
Contributor

Hello All,

I have table of data as below. I have to fetch single occurrence row. Please Help

Original Table

ID CA Value GrName UsrName DB Name

X1 CA1 CA1 Usr1 …

X2 CA2 CA2 Usr2 …

X2 CA2 CA2 Usr2 …

X3 CA5 CA5 Usr3 …

X3 CA5 CA5 Usr3 …

X3 CA5 CA5 Usr3 …

X4 CA7 CA7 Usr4 …

X4 CA7 CA7 Usr4 …

X5 CA9 CA9 Usr5 …

Desired Result Table

ID CA Value GrName UsrName DB Name

X1 CA1 CA1 Usr1 …

X5 CA9 CA9 Usr5 …

Thanks

Sathish R

Tags (3)
1 Solution

linu1988
Champion

Hello Sathish,
Try the below one.

source=blah.. |stats list(*) as * by ID|eval a=mvcount(CA)|where a=1

This will give you single occurrence of ID field.

Thanks,
L

View solution in original post

linu1988
Champion

Hello Sathish,
Try the below one.

source=blah.. |stats list(*) as * by ID|eval a=mvcount(CA)|where a=1

This will give you single occurrence of ID field.

Thanks,
L

rsathish47
Contributor

Thanks for the workaround.. It Works

0 Karma

rsathish47
Contributor

Thanks Changwoo.. I need single occurrence row not unique row.

0 Karma

changwoo
Communicator

try to use "| dedup ID" search command

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...