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!

Transforming Financial Data into Fraud Intelligence

Every day, banks and financial companies handle millions of transactions, logins, and customer interactions ...

How to send events & findings from AWS to Splunk using Amazon EventBridge

Amazon EventBridge is a serverless service that uses events to connect application components together, making ...

Exciting News: The AppDynamics Community Joins Splunk!

Hello Splunkers,   I’d like to introduce myself—I’m Ryan, the former AppDynamics Community Manager, and I’m ...