Splunk Search

How to add contributing fields to unique values?

girtsgr
Explorer

Hi, I seem to be stuck with something pretty trivial. I have events with users and corresponding hostnames, eg:

User Hostname
user1 hostA
user1 hostB
user2 hostA
user2 hostC
user3 hostD

 

I want to count unique user-hostname values and show the contributing hostnames for users that have used more that 1 hostname like this:

User Hostnames used
user1 hostA hostB
user2 hostA hostC

 

This seems to take care of the first part of the task:

 

 

| stats dc(Hostname) as uh by User
| search uh > 1

 

 

 

How can I add the contributing Hostnames?

Formatting is not so important - it may be one field with all the hostnames like in the example above, or multiple fields, or one field together with the User field.

 

Thank you.

 

 

Labels (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| stats values(hostname) as hostnames by User
| eval uh=mvcount(hostnames)
| where uh > 1

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| stats values(hostname) as hostnames by User
| eval uh=mvcount(hostnames)
| where uh > 1
0 Karma

girtsgr
Explorer

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!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

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