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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...