how we can colour the text as green for status as running and red for stopped for single value visualization in dashboard studio splunk.
My Code is below :-
You can use the dynamic formatting, please refer here
Please find a run anywhere example
You can change the status in the drop down and will be reflected in the search by using token. Based on the status, the color changes
{
"visualizations": {
"viz_NJsTjQl4": {
"type": "splunk.singlevalue",
"options": {
"majorColor": "> majorValue | matchValue(majorColorEditorConfig)"
},
"dataSources": {
"primary": "ds_275I8YNY"
},
"context": {
"majorColorEditorConfig": [
{
"match": "Running",
"value": "#118832"
},
{
"match": "Stopped",
"value": "#d41f1f"
}
]
}
}
},
"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"
}
This is ok, but not helping me out as I do not want the dropdown as status as mentioned below. Even I applied below changes in my code but the color for stopped and running did not change. below is my code after a change but no color change happened, Please help me here asap.
This solution is not helping us please provide some good solution so that i can change the colour in the single value itself as I am not using the dropdown as status . Even I applied above changes in my code but the color for stopped and running did not change. above is my code after a change but no color change happened, Please help me here asap.