Splunk Search

How to replace a field's contents based on their number?

GenericSplunkUs
Path Finder

I'm trying to replace the contents of a field to the severity based on the number (I.E. 0 to 19 with Low, 20 to 39 with Medium).

The field can have the numbers 1 to 99 in them and I want the output to display the severity in text.

Low (0 to 19),
Medium (20 to 39),
High (40 to 59),
Critical (60 to 79),
Emergency (80 to 99)

I've tried rex=Severity mode=sed "s/1/Low/g" and it'll work but I need to do a range from 0 to 19. All 99 in a rex style goes over the allowed search characters.

How would I achieve this?

0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Check out the rangemap command.

... | rangemap field=Severity Low=0-19 Medium=20-39 High=40-50 Critical=60-79 Emergency=80-99 | table range
---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

Check out the rangemap command.

... | rangemap field=Severity Low=0-19 Medium=20-39 High=40-50 Critical=60-79 Emergency=80-99 | table range
---
If this reply helps you, Karma would be appreciated.

GenericSplunkUs
Path Finder

Worked perfectly, Thank you.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...