Dashboards & Visualizations

Custom text - Table

mahesh27
Communicator
index=testindex source=application.logs
|rex "ErrorCode\:\[?<Error_Code>\d+]"
|search Error_Code IN(200, 500, 400, 505, 500)
|stats count by Error_Code
|Where count > 5

output:

Error_Codecount
20020
500100
40040
50545
50032


Instead of Errorcodes we want to display a custom text  as shown below.
How can we do this??

Expected output:

Error_Codecount
Application received with errorcode 20020
Application received with errorcode 500100
Application received with errorcode 40040
Application received with errorcode 50545
Application received with errorcode 50032

 

Labels (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Use the eval command to replace the Error_Code value with the desired text.

 

index=testindex source=application.logs
| rex "ErrorCode\:\[?<Error_Code>\d+]"
| search Error_Code IN (200, 500, 400, 505)
| stats count by Error_Code
| eval Error_Code = "Application received with errorcode " + Error_Code
| where count > 5

 

 

---
If this reply helps you, Karma would be appreciated.

View solution in original post

mahesh27
Communicator

hi @richgalloway , Even i tried with eval command but it did not work.
But i tried as per  your query it worked, thank you.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

I don't understand the reply.  Did my answer work or not?  If your problem is resolved, then please click the "Accept as Solution" button to help future readers.

---
If this reply helps you, Karma would be appreciated.
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Use the eval command to replace the Error_Code value with the desired text.

 

index=testindex source=application.logs
| rex "ErrorCode\:\[?<Error_Code>\d+]"
| search Error_Code IN (200, 500, 400, 505)
| stats count by Error_Code
| eval Error_Code = "Application received with errorcode " + Error_Code
| where count > 5

 

 

---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Earn a $35 Gift Card for Answering our Splunk Admins & App Developer Survey

Survey for Splunk Admins and App Developers is open now! | Earn a $35 gift card!      Hello there,  Splunk ...

Continuing Innovation & New Integrations Unlock Full Stack Observability For Your ...

You’ve probably heard the latest about AppDynamics joining the Splunk Observability portfolio, deepening our ...

Monitoring Amazon Elastic Kubernetes Service (EKS)

As we’ve seen, integrating Kubernetes environments with Splunk Observability Cloud is a quick and easy way to ...