Splunk Search

rangemap command

RobertRi
Communicator

Hello

I have a question about the rangemap command

In this example, I can define colors for various alert values

| rangemap field=alert green=1-5 red=5-100

is there a way or command to define the same colors with strings except integers like

| rangemap field=alert red="critical" orange="warning" green="ok"

or can I convert this field strings (warning, critical ...) into integers ?

Thanks Robert

ftk
Motivator

Hey Robert, rangemap expects numerical input, as such using strings to define colors will not work. You can however preface rangemapwith eval and convert your strings to integers. Here is an example, using your "alert" field:

| eval alert_level = case(alert=="ok",1,alert=="warning",2,alert=="critical",3) | rangemap field=alert_level green=1 orange=2 red=3
Get Updates on the Splunk Community!

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...