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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...

Updated Data Management and AWS GDI Inventory in Splunk Observability

We’re making some changes to Data Management and Infrastructure Inventory for AWS. The Data Management page, ...