- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

s20071035
Engager
03-26-2020
06:06 AM
I've got data say in following format (*there may be more than three types of exception)
Name,Exception,count
Jack,Null Pointer Exception,10
Jack,Number Format Exception,10
Jack,Other Exception,10
Tom,Null Pointer Exception,20
Tom,Number Format Exception,20
Tom,Other Exception,20
Dave,Null Pointer Exception,30
Dave,Number Format Exception,30
Dave,Other Exception,30
Required output is something like:
Name, Rank for Null Pointer Exception, Rank for Number format Exception...
Jack , 3 , 3 , 3
Tom , 2 , 2 , 2
Dave , 1 , 1 , 1
Any simple SPL can you suggest? Thank you.
1 Solution
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

woodcock
Esteemed Legend
03-26-2020
09:08 AM
Like this:
|makeresults | eval _raw="Name,Exception,count
Jack,Null Pointer Exception,10
Jack,Number Format Exception,10
Jack,Other Exception,10
Tom,Null Pointer Exception,20
Tom,Number Format Exception,20
Tom,Other Exception,20
Dave,Null Pointer Exception,30
Dave,Number Format Exception,30
Dave,Other Exception,30"
| multikv forceheader=1
| rename COMMENT AS "Everything above generates sample event data; everything below is your solution"
| stats sum(count) AS count BY Name Exception
| sort 0 - count
| streamstats count AS rank BY Exception
| rename COMMENT AS "Handle ties"
| eventstats first(rank) AS rank BY count
| chart first(rank) BY Name Exception
| rename *Exception AS "rank for *Exception"
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

woodcock
Esteemed Legend
03-26-2020
09:08 AM
Like this:
|makeresults | eval _raw="Name,Exception,count
Jack,Null Pointer Exception,10
Jack,Number Format Exception,10
Jack,Other Exception,10
Tom,Null Pointer Exception,20
Tom,Number Format Exception,20
Tom,Other Exception,20
Dave,Null Pointer Exception,30
Dave,Number Format Exception,30
Dave,Other Exception,30"
| multikv forceheader=1
| rename COMMENT AS "Everything above generates sample event data; everything below is your solution"
| stats sum(count) AS count BY Name Exception
| sort 0 - count
| streamstats count AS rank BY Exception
| rename COMMENT AS "Handle ties"
| eventstats first(rank) AS rank BY count
| chart first(rank) BY Name Exception
| rename *Exception AS "rank for *Exception"
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
rmmiller
Contributor
03-26-2020
09:30 AM
Fiendishly clever!
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

s20071035
Engager
03-26-2020
09:29 AM
Thank you so much for your help!
