Splunk Search

Grouping similar field1 into a table where field2 is different

brywilk_umich
Path Finder

Hello,

I have the a search that is working and I get the desired output. Now I am trying to make the output "prettier". Basically I want to group the username field so that it only displays once in the table and the second ipAddr field would be combined with each result in a vertical group. Hope that makes sense

The current output looks like

username1 ipAddr1
username1 ipAddr2
username2 ipAddr3
username2 ipAddr4

The desired output would be
username1 ipAddr1
ipAddr2

username2 ipAddr3
ipAddr4

Tags (3)

kristian_kolb
Ultra Champion

The simpler way to accomplish almost the same thing (if it's just for presentation purposes) is;

... | stats values(ipAddr) by username

that's it.

The values(field) function give you the distinct values for the field.
The list(field) function would give you all values for the field (including duplicates).

/K

0 Karma

brywilk_umich
Path Finder

I was able to figure it out from another users question but posting answer here in case someone else needs it

.... | streamstats current=f last(username) as previousUsername | eval username=if(match(username,previousUsername),"",username)| fields - "previousUsername" | table username ipAddr

0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...