Splunk Search

How to search count by unique ID?

raindrop18
Communicator

I have this string, which extracts and counts permit user per class

index="mysite" sourcetype="Access" AND Permit | rex ^\S+\s+\S+\s+(?\S+) | timechart count by city

now I want to count not just number of permit user but unique permit user, so I have included the ID field

index="mysite" sourcetype="Access" AND "Permit" AND "ID" | rex ^\S+\s+\S+\s+(?\S+) | timechart count by city

how I can include ID to be the count for only the unique permit user. my expectation is to have

unique ID + permit + city

Tags (3)
0 Karma
1 Solution

somesoni2
SplunkTrust
SplunkTrust

This would be my guess without the sample data.

index="mysite" sourcetype="Access" AND "Permit" AND "ID" | rex ^S+s+S+s+(?<city>S+)| timechart count dc(ID) as unique by city

View solution in original post

somesoni2
SplunkTrust
SplunkTrust

This would be my guess without the sample data.

index="mysite" sourcetype="Access" AND "Permit" AND "ID" | rex ^S+s+S+s+(?<city>S+)| timechart count dc(ID) as unique by city

raindrop18
Communicator

thanks, it is very helpfull. I am simply use "stats dc(id) by city" and work.

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 ...