Splunk Search

How to edit my search to create a table with the distinct count of users by domain?

DEAD_BEEF
Builder

I am trying to create a table that shows the number of distinct users that have logged into a machine. I am having problems getting the domain to appear next to the distinct user count.

Current search& output
index=logs event=logon | dc(username) AS UserCount

UserCount
106

DESIRED Output

Domain            UserCount
GUEST                 20
INTERNAL              72
EXTERNAL              4
WIRELESS              10

I tried various permutations of stats count by, table, and sum, but I just can't seem to figure it out.

0 Karma
1 Solution

s2_splunk
Splunk Employee
Splunk Employee

Does index=logs event=logon | stats dc(username) AS UserCount by Domain not give you what you want?

View solution in original post

s2_splunk
Splunk Employee
Splunk Employee

Does index=logs event=logon | stats dc(username) AS UserCount by Domain not give you what you want?

DEAD_BEEF
Builder

Yea... that's exactly what I needed. Can't believe I overlooked something so simple, I was waaaay over-thinking it. Thank you.

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!

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

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...