<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How do you change the background color of a timechart if there is a value of zero ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-change-the-background-color-of-a-timechart-if-there/m-p/390412#M113714</link>
    <description>&lt;P&gt;Hi @DalJeanis I think I can break up the SPL query into individual searches to avoid using trellis.  Can you give me an example of how to do it with a "normal chart"?  Then I can try implementing it via &lt;CODE&gt;&amp;lt;done&amp;gt;&lt;/CODE&gt; as you mentioned?&lt;/P&gt;</description>
    <pubDate>Mon, 31 Dec 2018 19:02:09 GMT</pubDate>
    <dc:creator>DEAD_BEEF</dc:creator>
    <dc:date>2018-12-31T19:02:09Z</dc:date>
    <item>
      <title>How do you change the background color of a timechart if there is a value of zero ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-change-the-background-color-of-a-timechart-if-there/m-p/390410#M113712</link>
      <description>&lt;P&gt;I have a simple timechart that looks at the _internal index for various hosts and makes a simple timechart span by hour.  I trellis this by host so I get say 8 medium sized timecharts that show log counts over the last 3 days.  Sometimes, some of these hosts go down and the value obviously goes to zero.&lt;/P&gt;

&lt;P&gt;How do I make the background panel for that host colored red when any of the values is zero?  In other words, I want to capture the attention of my users when any of the hosts have a time when there are no logs.  If this isn't possible, I'd be open to other suggestions that would get a users attention.  I already have alerts set up as well, but this dashboard is also important, and I want to make it easier to capture the user's attention.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| tstats count where index=_internal host=myhost00* by host_time prestats=t span=1h
| timechart span=1h count by host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Final working SPL&lt;/STRONG&gt;.  Since I have multiple hosts, I just broke them down into individual searches and removed the &lt;CODE&gt;&amp;lt;panel&amp;gt;&lt;/CODE&gt; tags to make them look like one big panel.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard&amp;gt;
  &amp;lt;label&amp;gt;Test Dashboard&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;chart&amp;gt;
        &amp;lt;search id="pre"&amp;gt;
          &amp;lt;query&amp;gt;| tstats count where index=_internal host=system1 BY host _time prestats=t span=1h
                 | timechart span=1h count AS mycount
          &amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-48h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;@h&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="charting.backgroundColor"&amp;gt;$myColorToken$&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart"&amp;gt;line&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;preview&amp;lt;/option&amp;gt;
      &amp;lt;/chart&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
  &amp;lt;search base="pre"&amp;gt;
    &amp;lt;query&amp;gt;| stats min(mycount) AS mincount&amp;lt;/query&amp;gt;
    &amp;lt;done&amp;gt;
      &amp;lt;eval token="myColorToken"&amp;gt;if($result.mincount$&amp;amp;lt;=0,"red","white")&amp;lt;/eval&amp;gt;
    &amp;lt;/done&amp;gt;
  &amp;lt;/search&amp;gt;
&amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 Dec 2018 03:36:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-change-the-background-color-of-a-timechart-if-there/m-p/390410#M113712</guid>
      <dc:creator>DEAD_BEEF</dc:creator>
      <dc:date>2018-12-31T03:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do you change the background color of a timechart if there is a value of zero ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-change-the-background-color-of-a-timechart-if-there/m-p/390411#M113713</link>
      <description>&lt;P&gt;With a normal chart, it would be easy enough.   You'd do a post process search to calculate the lowest value and on &lt;CODE&gt;&amp;lt;done&amp;gt;&lt;/CODE&gt; set a background color based on that.&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;Updated with more details as per request...&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;In your SPL, you will do something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;search id="whatever"&amp;gt;
    &amp;lt;query&amp;gt;
     ... your search stuff...
     | timechart span=1h count as mycount
    &amp;lt;/query&amp;gt;
&amp;lt;/search&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Elsewhere, you will have another search that uses that one as its base&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;search base="whatever"&amp;gt;
    &amp;lt;query&amp;gt;
    | stats min(mycount) as mincount
    &amp;lt;/query&amp;gt;
     &amp;lt;done&amp;gt;
      &amp;lt;eval token="myColorToken"&amp;gt;if($result.minfoo$&amp;amp;lt;=0,"red","green")&amp;lt;/eval&amp;gt;
    &amp;lt;/done&amp;gt;
&amp;lt;/search&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In your chart, you are going to have a line like this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;option name="charting.backgroundColor"&amp;gt;$myColorToken$&amp;lt;/option&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The above is all aircode, but should be reasonably close.  You can test each chunk by hardcoding, such as hardcoding a &lt;CODE&gt;&amp;lt;set&amp;gt;&lt;/CODE&gt; command with your color values and seeing that the backgroundColor option is working, and so on.  &lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;Unfortunately, &lt;CODE&gt;trellis&lt;/CODE&gt; is a bit of a blunt instrument at the moment.  I can see a way to do this with &lt;CODE&gt;singles&lt;/CODE&gt;, but not timecharts. &lt;/P&gt;

&lt;P&gt;Paging @niketnilay...&lt;/P&gt;</description>
      <pubDate>Mon, 31 Dec 2018 18:18:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-change-the-background-color-of-a-timechart-if-there/m-p/390411#M113713</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-12-31T18:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do you change the background color of a timechart if there is a value of zero ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-change-the-background-color-of-a-timechart-if-there/m-p/390412#M113714</link>
      <description>&lt;P&gt;Hi @DalJeanis I think I can break up the SPL query into individual searches to avoid using trellis.  Can you give me an example of how to do it with a "normal chart"?  Then I can try implementing it via &lt;CODE&gt;&amp;lt;done&amp;gt;&lt;/CODE&gt; as you mentioned?&lt;/P&gt;</description>
      <pubDate>Mon, 31 Dec 2018 19:02:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-change-the-background-color-of-a-timechart-if-there/m-p/390412#M113714</guid>
      <dc:creator>DEAD_BEEF</dc:creator>
      <dc:date>2018-12-31T19:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do you change the background color of a timechart if there is a value of zero ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-change-the-background-color-of-a-timechart-if-there/m-p/390413#M113715</link>
      <description>&lt;P&gt;Thank you @DalJeanis! Just needed to encode the "&amp;lt;" but otherwise it worked perfectly.  First time for me using these tags, learning new SPL everyday.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Dec 2018 23:00:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-change-the-background-color-of-a-timechart-if-there/m-p/390413#M113715</guid>
      <dc:creator>DEAD_BEEF</dc:creator>
      <dc:date>2018-12-31T23:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do you change the background color of a timechart if there is a value of zero ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-change-the-background-color-of-a-timechart-if-there/m-p/390414#M113716</link>
      <description>&lt;P&gt;Ah, yes.  updated &lt;CODE&gt;&amp;lt;&lt;/CODE&gt; to &lt;CODE&gt;&amp;amp;lt;&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Jan 2019 04:24:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-change-the-background-color-of-a-timechart-if-there/m-p/390414#M113716</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2019-01-01T04:24:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do you change the background color of a timechart if there is a value of zero ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-change-the-background-color-of-a-timechart-if-there/m-p/390415#M113717</link>
      <description>&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt; I will keep quiet if this works straight-forward with several charts powered by individual queries. &lt;CODE&gt;&amp;lt;condition match="$job.resultCount$==0"&amp;gt;&lt;/CODE&gt; (i.e. to capture Search returned no results) can also be used with &lt;CODE&gt;&amp;lt;done&amp;gt;&lt;/CODE&gt; and &lt;CODE&gt;&amp;lt;progress&amp;gt;&lt;/CODE&gt; Search Event Handlers to achieve same results to set background color of the chart!&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jan 2019 16:49:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-change-the-background-color-of-a-timechart-if-there/m-p/390415#M113717</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-01-02T16:49:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do you change the background color of a timechart if there is a value of zero ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-change-the-background-color-of-a-timechart-if-there/m-p/390416#M113718</link>
      <description>&lt;P&gt;Yes, but I couldn't type that one as aircode, and didn't want to take the time to google the exact capitalization...&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jan 2019 19:00:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-change-the-background-color-of-a-timechart-if-there/m-p/390416#M113718</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2019-01-02T19:00:00Z</dc:date>
    </item>
  </channel>
</rss>

