Dashboards & Visualizations

Dashboard Studio : Representing Row in Colors as per the value

Sishad
Explorer

Hi Splunk experts,

I have made a dashboard which show my App's service status in Dashboard Studio and I want to display color based on value as show below.
This was achieved in Dashboard classic by editing the source and appending the format as below.

Sishad_0-1716972488355.png

 

</format>
        <format type="color" field="Requester">
          <colorPalette type="expression">case (match(value,"DOWN"), "#E34234",match(value,"NA"), "#F8BE34",match(value,"UP"),"#4F7942")</colorPalette>
               <format type="color" field="Stripping">
          <colorPalette type="expression">case (match(value,"DOWN"), "#E34234",match(value,"NA"), "#F8BE34",match(value,"UP"),"#4F7942")</colorPalette>
        </format>

 

Can the same be achieved in Dashboard studio as well ? If so how it can be done.

Can you guys please help me out on this.TIA

 

 

 

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this

    "options": {
        "columnFormat": {
            "Requester": {
                "rowBackgroundColors": "> table | seriesByName(\"Requester\") | matchValue(requesterColumnFormatConfig)"
            }
        }
    },
    "context": {
        "requesterColumnFormatConfig": [
            {
               "match": "DOWN",
               "value": "#FF0000"
           },
           {
               "match": "UP",
               "value": "#00FF00"
           }  
       ]
    }
0 Karma

Sishad
Explorer

Sishad_0-1717079323032.png

No luck as it throws an error saying "must NOT have additional properties" in JSON.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

It looks like you didn't read what I had suggested properly as you have missed the "options" key

0 Karma

Sishad
Explorer

Yes I have added it. Please find below the complete source code.

{
    "type": "ds.search",
    "options": {
        "query": "index = index host=hostname source=\"/var/log/history-*.log\" servername | table Websphere GUI  \n| eval Websphere=if(Websphere=\"0\",\"UP\",\"DOWN\")\n| eval GUI=if(GUI=\"0\",\"UP\",\"DOWN\")",
        "queryParameters": {
            "earliest": "-10m@m",
            "latest": "now"
        },
        "refresh": "10m",
        "refreshType": "delay"
    },
    "options": {
        "columnFormat": {
            "Websphere": {
                "rowBackgroundColors": "> table | seriesByName(\"Websphere\") | matchValue(WebsphereColumnFormatConfig)"
            }
        }
    },
    "context": {
        "WebsphereColumnFormatConfig": [
            {
               "match": "DOWN",
               "value": "#FF0000"
           },
           {
               "match": "UP",
               "value": "#00FF00"
           }, 
       ]
    }

    "name": "DC  Web Server _ search"
}



0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
{
    "visualizations": {
        "viz_yxqQUaLH": {
            "type": "splunk.table",
            "options": {
                "columnFormat": {
                    "Websphere": {
                        "rowBackgroundColors": "> table | seriesByName(\"Websphere\") | matchValue(nameColumnFormatConfig)"
                    },
                    "GUI": {
                        "rowBackgroundColors": "> table | seriesByName(\"GUI\") | matchValue(nameColumnFormatConfig)"
                    }
                },
                "backgroundColor": "transparent",
                "tableFormat": {
                    "rowBackgroundColors": "> table | seriesByIndex(0) | pick(tableRowBackgroundColorsByBackgroundColor)",
                    "headerBackgroundColor": "> backgroundColor | setColorChannel(tableHeaderBackgroundColorConfig)",
                    "rowColors": "> rowBackgroundColors | maxContrast(tableRowColorMaxContrast)",
                    "headerColor": "> headerBackgroundColor | maxContrast(tableRowColorMaxContrast)"
                }
            },
            "dataSources": {
                "primary": "ds_1ZOKlMox"
            },
            "context": {
                "nameColumnFormatConfig": [
                    {
                        "match": "DOWN",
                        "value": "#FF0000"
                    },
                    {
                        "match": "UP",
                        "value": "#00FF00"
                    }
                ]
            }
        }
    },
    "dataSources": {
        "ds_1ZOKlMox": {
            "type": "ds.search",
            "options": {
                "query": "| makeresults\n| eval Websphere=mvindex(split(\"DOWN,UP\",\",\"),random()%2)\n| eval GUI=mvindex(split(\"DOWN,UP\",\",\"),random()%2)\n| table Websphere GUI",
                "queryParameters": {
                    "earliest": "-24h@h",
                    "latest": "now"
                }
            },
            "name": "Search_2"
        }
    },
    "defaults": {
        "dataSources": {
            "ds.search": {
                "options": {
                    "queryParameters": {
                        "latest": "$global_time.latest$",
                        "earliest": "$global_time.earliest$"
                    }
                }
            }
        }
    },
    "inputs": {},
    "layout": {
        "type": "absolute",
        "options": {
            "width": 1440,
            "height": 960,
            "display": "auto"
        },
        "structure": [
            {
                "item": "viz_yxqQUaLH",
                "type": "block",
                "position": {
                    "x": 20,
                    "y": 20,
                    "w": 480,
                    "h": 230
                }
            }
        ],
        "globalInputs": []
    },
    "description": "",
    "title": "Webstatus"
}
0 Karma
Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...