Splunk Cloud Platform

Single card value background color change

PATAN
Observer

In Splunk studio, I have a  Status field with the values DROPPED and NOT DROPPED. If I get Dropped the background color of the card should change into Green... If the field value is NOT DROPPED. It should be Red. How can I achieve it in splunk studio. 

 

 

Thanks

Labels (1)
0 Karma

renjith_nair
Legend

You can use the dynamic element color

https://docs.splunk.com/Documentation/Splunk/9.2.1/DashStudio/ModifyDOS

select background and set the color based on the status

 

renjith_nair_0-1714485468615.png

Here is a run anywhere example

Just change the status in the dropdown and you can see the color changes

{
    "visualizations": {
        "viz_NJsTjQl4": {
            "type": "splunk.singlevalue",
            "options": {
                "backgroundColor": "> majorValue | matchValue(backgroundColorEditorConfig)",
                "majorColor": "#ffffff"
            },
            "dataSources": {
                "primary": "ds_275I8YNY"
            },
            "context": {
                "backgroundColorEditorConfig": [
                    {
                        "match": "Stopped",
                        "value": "#ad3f20"
                    },
                    {
                        "match": "Running",
                        "value": "#207865"
                    }
                ]
            }
        }
    },
    "dataSources": {
        "ds_275I8YNY": {
            "type": "ds.search",
            "options": {
                "query": "| makeresults\n| eval value=\"$status$\""
            },
            "name": "Search_1"
        }
    },
    "defaults": {
        "dataSources": {
            "ds.search": {
                "options": {
                    "queryParameters": {
                        "latest": "$global_time.latest$",
                        "earliest": "$global_time.earliest$"
                    }
                }
            }
        }
    },
    "inputs": {
        "input_global_trp": {
            "type": "input.timerange",
            "options": {
                "token": "global_time",
                "defaultValue": "-24h@h,now"
            },
            "title": "Global Time Range"
        },
        "input_BHJAbWl2": {
            "options": {
                "items": [
                    {
                        "label": "Running",
                        "value": "Running"
                    },
                    {
                        "label": "Stopped",
                        "value": "Stopped"
                    }
                ],
                "token": "status",
                "selectFirstSearchResult": true
            },
            "title": "Status",
            "type": "input.dropdown"
        }
    },
    "layout": {
        "type": "grid",
        "options": {
            "width": 1440,
            "height": 960
        },
        "structure": [
            {
                "item": "viz_NJsTjQl4",
                "type": "block",
                "position": {
                    "x": 0,
                    "y": 0,
                    "w": 1440,
                    "h": 400
                }
            }
        ],
        "globalInputs": [
            "input_global_trp",
            "input_BHJAbWl2"
        ]
    },
    "description": "",
    "title": "single_panel_studio"
}
---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...