Splunk Search

How to add severity to fetched errors messages?

PraveenThakur
Engager

Hi All,

I am trying to add severity column to output of first command, could you please let me know how to do it.

Query I have created is :

index=abc source=xyz | table _time ID STATUS ERROR_Name
| search ERROR_Name IN
("EndDate must be after StartDate""The following is required: PersonName" ....many others)
| join type=inner ID[search index=abc source=xyz STATUS IN (FATAL,SUCCESS)
| table _time ID STATUS
| stats latest(STATUS) as STATUS by ID
| search STATUS IN (FATAL) | fields ID]
| stats latest(STATUS) as STATUS by ID ERROR_Name
| search STATUS IN (FATAL) | top 50 ERROR_Name | appendcols [| eval severity = case(ERROR_Name=="EndDate must be after StartDate", "One", ERROR_Name=="The following is required: PersonName", "two")]

Labels (2)
Tags (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

appendcols is not the answer in so many cases - just create a new field (column) with the eval command

index=abc source=xyz | table _time ID STATUS ERROR_Name
| search ERROR_Name IN
("EndDate must be after StartDate""The following is required: PersonName" ....many others)
| join type=inner ID[search index=abc source=xyz STATUS IN (FATAL,SUCCESS)
| table _time ID STATUS
| stats latest(STATUS) as STATUS by ID
| search STATUS IN (FATAL) | fields ID]
| stats latest(STATUS) as STATUS by ID ERROR_Name
| search STATUS IN (FATAL) | top 50 ERROR_Name 
| eval severity = case(ERROR_Name=="EndDate must be after StartDate", "One", ERROR_Name=="The following is required: PersonName", "two")

 

View solution in original post

PraveenThakur
Engager

Thanks a lot it has solved my problem

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

appendcols is not the answer in so many cases - just create a new field (column) with the eval command

index=abc source=xyz | table _time ID STATUS ERROR_Name
| search ERROR_Name IN
("EndDate must be after StartDate""The following is required: PersonName" ....many others)
| join type=inner ID[search index=abc source=xyz STATUS IN (FATAL,SUCCESS)
| table _time ID STATUS
| stats latest(STATUS) as STATUS by ID
| search STATUS IN (FATAL) | fields ID]
| stats latest(STATUS) as STATUS by ID ERROR_Name
| search STATUS IN (FATAL) | top 50 ERROR_Name 
| eval severity = case(ERROR_Name=="EndDate must be after StartDate", "One", ERROR_Name=="The following is required: PersonName", "two")

 

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...