Splunk Search

renaming search results...

DTERM
Contributor

index=MyApp | stats count by supportGroup, severity

That search provides me a list of events and the severity associated with the events. The severity comes up as 1,2,3,4 or 5. Is there a way for me to rename the severity to something helpful like

1 - low
2 - medium
3 - attention
4 - severe
5 - critical

Tags (1)
1 Solution

Ayn
Legend

If you want to do it inline in your search, you can use the eval function case:

index=MyApp 
| eval severityDesc=case(severity==1,"low",severity==2,"medium",severity==3,"attention",severity==4,"severe",severity==5,"critical") 
| stats count by supportGroup, severityDesc

You could also use a lookup table that maps the severity levels to their respective descriptions using information in a CSV file. More information on lookup tables is available in the docs: http://www.splunk.com/base/Documentation/latest/Knowledge/Addfieldsfromexternaldatasources

View solution in original post

Ayn
Legend

If you want to do it inline in your search, you can use the eval function case:

index=MyApp 
| eval severityDesc=case(severity==1,"low",severity==2,"medium",severity==3,"attention",severity==4,"severe",severity==5,"critical") 
| stats count by supportGroup, severityDesc

You could also use a lookup table that maps the severity levels to their respective descriptions using information in a CSV file. More information on lookup tables is available in the docs: http://www.splunk.com/base/Documentation/latest/Knowledge/Addfieldsfromexternaldatasources

nagarajsf
Explorer

Hello @Ayn ,

it could be work for numbers only or will work for sting value with some wild entry like below,
MANAGER contains with prefixed value prd so that I'm expecting eval like

   eval name=case(MANAGER==prdehdp* OR prdplhdpx*  OR  *prdasdp*,"prd") |
    eval name1=case(X==dev* ,"dev") |
    eval name2=case(Y==QAT*,"QAT") | stats count by name,name1,name2

Thanks

0 Karma

DTERM
Contributor

This solution works great. However, does this imply that I cannot click click on the renamed severity levels now and drill into the results as I could earlier? The results are exactly what I wanted. However, nothing happens when I click on the text string.

0 Karma
Get Updates on the Splunk Community!

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...