Splunk Search

How to get the result of sorting in a group?

flzhang132
Explorer

I want to get the result of sorting in the group.
alt text

0 Karma
1 Solution

adonio
Ultra Champion

maybe try this:

| makeresults count=1
| eval data = "host1,a;host1,b;host2,c;host2,d;host3,a"
| makemv delim=";" data
| mvexpand data
| rex field=data "(?<project>[^,]+)\,(?<value>\S+)"
| table project value
| rename COMMENT as "the above creates data, below is the solution"
| streamstats count as number by project

hope it helps

View solution in original post

0 Karma

adonio
Ultra Champion

maybe try this:

| makeresults count=1
| eval data = "host1,a;host1,b;host2,c;host2,d;host3,a"
| makemv delim=";" data
| mvexpand data
| rex field=data "(?<project>[^,]+)\,(?<value>\S+)"
| table project value
| rename COMMENT as "the above creates data, below is the solution"
| streamstats count as number by project

hope it helps

0 Karma
Get Updates on the Splunk Community!

.conf23 Registration is Now Open!

Time to toss the .conf-etti &#x1f389; —  .conf23 registration is open!   Join us in Las Vegas July 17-20 for ...

Don't wait! Accept the Mission Possible: Splunk Adoption Challenge Now and Win ...

Attention everyone! We have exciting news to share! We are recruiting new members for the Mission Possible: ...

Unify Your SecOps with Splunk Mission Control

In today’s post, I'm excited to share some recent Splunk Mission Control innovations. With Splunk Mission ...