- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
mahesh27
Communicator
07-23-2024
01:16 PM
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_Code | count |
200 | 20 |
500 | 100 |
400 | 40 |
505 | 45 |
500 | 32 |
Instead of Errorcodes we want to display a custom text as shown below.
How can we do this??
Expected output:
Error_Code | count |
Application received with errorcode 200 | 20 |
Application received with errorcode 500 | 100 |
Application received with errorcode 400 | 40 |
Application received with errorcode 505 | 45 |
Application received with errorcode 500 | 32 |
1 Solution
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

richgalloway

SplunkTrust
07-23-2024
01:41 PM
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.
If this reply helps you, Karma would be appreciated.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
mahesh27
Communicator
07-23-2024
02:08 PM
hi @richgalloway , Even i tried with eval command but it did not work.
But i tried as per your query it worked, thank you.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

richgalloway

SplunkTrust
07-24-2024
05:16 AM
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.
If this reply helps you, Karma would be appreciated.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

richgalloway

SplunkTrust
07-23-2024
01:41 PM
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.
If this reply helps you, Karma would be appreciated.
