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
Get Updates on the Splunk Community!

Dashboards: Hiding charts while search is being executed and other uses for tokens

There are a couple of features of SimpleXML / Classic dashboards that can be used to enhance the user ...

Splunk Observability Cloud's AI Assistant in Action Series: Explaining Metrics and ...

This is the fourth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how ...

Brains, Bytes, and Boston: Learn from the Best at .conf25

When you think of Boston, you might picture colonial charm, world-class universities, or even the crack of a ...