Splunk Search

Help with CSS partially not working

thatsabhijeet
Explorer

I am trying to hide RED, GREEN and YELLOW, but the xml css is not working for me.


<form>
<row>
<panel>
<html>
<style>
#tbl_Summary tbody td div.multivalue-subcell[data-mv-index="1"]
{display: none;}
</style>
</html>

<table id="tbl_Summary">
<title>Summary</title>
<search>
<query>
index=*xyz
| eval calsuc=case(match('code',"1"), "SUCCESS", match('code',"2"), "WARNING", match('code',"1"), "FAILURE")
| dedup requestId
| eval APPLICATION=case(like('apn',"/PROFILE"),"PROFILE")
| stats Count as "Total Count" count(eval(calsuc="SUCCESS")) as "TotalSuccess" count(eval(calsuc="WARNING")) as "TotalWarning" count(eval(calsuc="FAILURE")) as "TotalFailure"
| rename TotalSuccess as S, TotalWarning as W, TotalFailure as F
| eval SuccessPerc=round(((S)/(S+W+F)),100,2)
| eval sign=round(SuccessPerc, 0)
| eval colorCd= if(sign>=95,"GREEN",if(95>sign AND sign>=80,"YELLOW", "RED"))
| eval ApplicationName=APPLICATION."|".'colorCd'
</query>
<earliest>$sltd_tm.earliest$</earliest>
<latest>$sltd_tm.latest$</earliest>
</search>
<option name="count">20</option>
<option name="drilldown">row</option>
<format type="color">
<colorPalette type="expression">
case (match(value,"RED"), "#DC4E41", match(value,"YELLOW"),"#F88E34",match(value,"GREEN"),"#53A051")
</colorPalette>
</format>
</table>
</panel>
</row>
</form>

583a918a-42d7-43e2-b79a-447e19b0d77f.jpg



Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

For this technique to work, you missed an essential detail. The colour has to be in a multivalue field

Change

| eval ApplicationName=APPLICATION."|".'colorCd'

to

| eval ApplicationName=mvappend(APPLICATION,colorCd)

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

For this technique to work, you missed an essential detail. The colour has to be in a multivalue field

Change

| eval ApplicationName=APPLICATION."|".'colorCd'

to

| eval ApplicationName=mvappend(APPLICATION,colorCd)

thatsabhijeet
Explorer

Dear @ITWhisperer , It is working for the above mentioned table. But when I use the same in another table, the data inside the cell is getting hidden.

Here is the below code and screenshot.

<row>
<panel>
<html>
<style>
#highlight tbody td div.multivalue-subcell[data-mv-index="1"]
{display: none;}
</style>
</html>

<table id="highlight">
<title>Profile</title>
<search>
<query>
index=*xyz apn IN (/PROFILE)
| eval calsuc=case(match('code',"1"), "SUCCESS", match('code',"2"), "WARNING", match('code',"1"), "FAILURE")
| dedup requestId
| stats  count(eval(calsuc="SUCCESS")) as "TotalSuccess" count(eval(calsuc="WARNING")) as "TotalWarning" count(eval(calsuc="FAILURE")) as "TotalFailure"
| rename TotalSuccess as S, TotalWarning as W, TotalFailure as F
| eval SuccessPerc=round(((S)/(S+W+F)),100,2)
| eval WarningPerc=round(((W)/(S+W+F)),100,2)
| eval FailurePerc=round(((F)/(S+W+F)),100,2)

| eval sign=round(SuccessPerc, 2)
| eval colorCd= if(sign>=95,"GREEN",if(95>sign AND sign>=80,"YELLOW", "RED"))
| eval TotalCount=mvappend("SUCCESS "+" : "+'SUCCESS' +"("+'SuccessPerc'+")",  "WARNING"+" : "+'WARNING' +"("+'WarningPerc'+")", "FAILURE"+" : "+'FAILURE' +"("+'FailurePerc'+")")
| eval status=mvjoin(Totalcount,"  ")
| eval statusNew=mvappend(status, colorCd)
| chart values(statusNew) as tot by flowNm Country
| fillnull value="No Value"
</query>
<earliest>$sltd_tm.earliest$</earliest>
<latest>$sltd_tm.latest$</earliest>
</search>
<option name="count">20</option>
<option name="drilldown">row</option>
<format type="color">
<colorPalette type="expression">
case (match(value,"RED"), "#DC4E41", match(value,"YELLOW"),"#F88E34",match(value,"GREEN"),"#53A051")
</colorPalette>
</format>
</table>
</panel>
</row>
test image1.JPGtest image2.JPG

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try changing

| chart values(statusNew) as tot by flowNm Country

to

| chart list(statusNew) as tot by flowNm Country

This is because values() puts the values in (lexicographically) sorted order whereas list() does not sort. YELLOW comes after SUCCESS, so is at index 1, whereas GREEN and RED come before SUCCESS so end up at index 0.

thatsabhijeet
Explorer

Dear @ITWhisperer ,

It works perfectly fine now. Thank you so much.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...