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
Revered Legend

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
Revered Legend

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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...