Dashboards & Visualizations

change the color of a single value panel based on time

sravani27
Path Finder

Hi guys, I am trying to change the color of a single value panel based on the timestamp.
Eg: if the count is > 5 from 12 am - 8 am - the panel should be green, and if the count is > 5 from 8 am - 6 pm - the panel should be red.
I am trying to dynamically change the colors based on the timerange
Please help.

Tags (1)

niketn
Legend

@sravani27 please add more details to your use case. What happens for 6:00 PM to midnight? Also what is count is <5 what happens during all the timings?

What is the query to fetch count? Could you please add some sample data and SPL? Please mock/anonymize any sensitive information. I your count some kind of count for current hour and based on hour of the day you want to color the count?

In order for the community to assist you better please provide further details as requested. This seems to be a use case for Simple XML JS extension where you would color based on current hour and count returned by the query. Please confirm!

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

Goldbeed
Engager

I couldent figure out a way to edit the colors in the search but you can in the dashboards. I don't think you can in search.

Search:
| sort - time | eval VioletTimes>1.5sec = if (time>1.5,time ,0) | eval RedTimes>1sec = if(time <=1.5 AND time >1,time ,0) | eval OrangeTimes>750ms = if(time <=1 AND time >0.75,time ,0) | eval .YellowTimes>500ms = if(time <=0.75 AND time >0.5,time ,0) | eval .NormalTimes<500ms = if(time <=0.5, time , 0) | fields - time

XML edit on dashboard
{"VioletTimes>1.5sec":0x8B2252, "RedTimes>1sec":0xFF0000, "OrangeTimes>750ms":0xFFA500, ".YellowTimes>500ms":0xFFFF00, ".NormalTimes<500ms":0x73A550}

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...