Splunk Search

How to Combine column from multiple search results?

Niro
Explorer

Hello, I have the following search

 

 

index=wineventlog EventCode=4728 OR EventCode = 4731 OR EventCode=4729 OR EventCode=4732 OR EventCode=4756  OR EventCode=4756 NOT src_user=*$
| rename src_user as admin, name as action
| table admin, Group_Name, user_name

 

 

This spits out output like this:

 

admin	Group_Name	user_name
adminx  GroupA  	UserA
adminx 	GroupB  	UserA
adminx 	GroupC  	UserA
adminy 	GroupD  	UserB
adminy 	GroupE  	UserB
adminy 	GroupF  	UserC
adminy 	GroupF  	UserD

 

 

I'm trying to combine them into a single message that looks like this:

 

admin	Group_Name	        user_name
adminx  GroupA,GroupB,GroupC  	UserA
adminy 	GroupD,GroupE    	UserB
adminy 	GroupF  	        UserC,UserD

 

 

What would be the best way to achieve that?

Labels (3)
Tags (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| stats values(Group_Name) as Group_Name by admin user_name
| eval Group_Name=mvjoin(Group_Name, ",")
| stats values(user_name) as user_name by admin Group_Name
| eval user_name=mvjoin(user_name,",")

View solution in original post

Niro
Explorer

That worked perfectly, thank you!

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| stats values(Group_Name) as Group_Name by admin user_name
| eval Group_Name=mvjoin(Group_Name, ",")
| stats values(user_name) as user_name by admin Group_Name
| eval user_name=mvjoin(user_name,",")
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

.conf25 Global Broadcast: Don’t Miss a Moment

Hello Splunkers, .conf25 is only a click away.  Not able to make it to .conf25 in person? No worries, you can ...

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...