Dashboards & Visualizations

Single value with trellis have to show color based on field value

999balaji9
Loves-to-Learn

Hi Team, 

Kindly help me with the below scenario.

 

As shown in the diagram my query is index=main |stats count by log_level

 

I would like to show the background color for Error is red, Warn is Amber, Info is green. The color shouldn't depend on the values. Whatever the count it does not matter. when the panels should always show red for ERROR Warn is Amber, Info is green

999balaji9_0-1620125447044.png

 

Kindly help me on the same 

 

Thanks & Regards,

Reddy

 

Labels (2)
0 Karma

sanjeev543
Communicator

@999balaji9  You can do it using format->Color option.. refer below screenshot

 

 

sanjeev543_1-1620579413657.png

 

0 Karma

999balaji9
Loves-to-Learn

Hi Sajeev,

 

Thanks for the reply I don't want to be based on the value I am aware of that color option. but I need based on the Error, Info, Warn based on this I required the color. I hope you understand.  If not please check the below screenshot. if it is the error I need red if it is the info I need Green if it is the warn need amber.  Hope this will clear my question. 

 

999balaji9_0-1620629201120.png

 

Thanks & Regards,

Balaji Reddy. 

 

0 Karma

TheFlash
Path Finder

TheFlash_0-1620136372147.png

you want this right ? 

Right mouse click on screen then click on inspect and and then check for the html tag where your value is, as you can see in below image there is a "id" in the div tag which is unique to my single value 

TheFlash_1-1620136734941.png

and you can also see my id="singlevalue" which is the child of div tag which have id="facet-viz_groupby_field_sourcetype_groupby_value_splunk_web_service", you will also see something similar for your panel. Since id is unique, I can use this to change the background color. Then create a .css file(for e.g. color.css) in $SPLUNK_HOME/etc/apps/<your-app-name>/appserver/static. And in that CSS file write the following code:

1. if you want background like red one, then write: 

#facet-viz_groupby_field_sourcetype_groupby_value_splunk_web_access{
background:red;
}

(here "#facet-viz_groupby_field_sourcetype_groupby_value_splunk_web_access" is the id you saw in above image"

2. if you want background like green one, then write:

#facet-viz_groupby_field_sourcetype_groupby_value_splunk_web_service>div#singlevalue{
background:green;
}

(here "div#singlevalue" is written to identify the child of "#facet-viz_groupby_field_sourcetype_groupby_value_splunk_web_service" )

If this help you, give an upvote 
Thank you

 

 

0 Karma

999balaji9
Loves-to-Learn

Hi Flash,

 

Thanks for the reply. But in my scenario all the 3 single value visualizations in same panel.  I hope you understand what I am trying to say. if not please let me know will explain clearly.

 

 

Thanks & Regards,

Reddy. 

0 Karma

TheFlash
Path Finder

I have used trellis, and my search query was index=_internal | stats count by sourcetype 

on the basis of that I have changed the background color as you can see in above reply.

you want to change the Background color as I have show right ?

if not then edit your screenshot in paint or any other s/w and tell what exactly you want and also mention the xml code ,  using some example which I can also perform and understand your situation better. 

0 Karma

sekarjegan93
Engager

Hi Thanks, this looks will work, But how this will apply specific to this dashboard and also is there any way easily use CSS from UI itself without doing changes in the backend?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

CSS can be added to the source of a simpleXML / classic dashboard (not Dashboard Studio). This is a very old post - you should start your own question which more specific information about your particular usecase so we can give you more targeted and relevant information.

0 Karma
Get Updates on the Splunk Community!

Fastest way to demo Observability

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

September Community Champions: A Shoutout to Our Contributors!

As we close the books on another fantastic month, we want to take a moment to celebrate the people who are the ...

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...