<?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: Chart colors by search values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Chart-colors-by-search-values/m-p/496340#M138324</link>
    <description>&lt;P&gt;&lt;STRONG&gt;Hi Balcv,&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I used index="_internal" since i haven't index="main" on my Splunk environment and just rename it to "index=main". Basically to answer your question, you can manually assign whatever color you want depending on the field name in your search. To do that you need to add new option name parameters for "charting.fieldColors" on your XML Dashboard.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;option name="charting.fieldColors"&amp;gt;{"wineventlog":0xFF0000, "main":0x008000}&amp;lt;/option&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Hex color values:&lt;/STRONG&gt;&lt;BR /&gt;
FF0000 = Red &lt;BR /&gt;
008000= Green&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Below is the search string i used.&lt;/STRONG&gt; &lt;/P&gt;

&lt;P&gt;index="_internal" OR index="wineventlog"&lt;BR /&gt;
| chart count AS total BY host, index&lt;BR /&gt;
| rename "VALUE_internal" AS "main"&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Try this full XML Code below so you can see and test it..&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard&amp;gt;
  &amp;lt;label&amp;gt;Column Chart (Manual change color depending on the field name on XML)&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;chart&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index="_internal" OR index="wineventlog"
| chart count AS total BY host, index
| rename "VALUE_internal" AS "main"&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-5m@m&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="charting.axisY.scale"&amp;gt;log&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart"&amp;gt;column&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.stackMode"&amp;gt;default&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.fieldColors"&amp;gt;{"wineventlog":0xFF0000, "main":0x008000}&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.legend.placement"&amp;gt;top&amp;lt;/option&amp;gt;
      &amp;lt;/chart&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;H2&gt;Let me know if this answer your question. Thanks&lt;/H2&gt;

&lt;P&gt;&lt;STRONG&gt;Kelz&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 02:22:04 GMT</pubDate>
    <dc:creator>kelz</dc:creator>
    <dc:date>2020-09-30T02:22:04Z</dc:date>
    <item>
      <title>Chart colors by search values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Chart-colors-by-search-values/m-p/496337#M138321</link>
      <description>&lt;P&gt;I have a column chart showing event counts based on host name from two different indexes:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="main" OR index="wineventlog" | stats count by host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I would like to achieve is to be able to show the hosts from the main index in one color and the hosts from wineventlog index as a different color.  &lt;/P&gt;

&lt;P&gt;I've used something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  (index="main" OR index="wineventlog") 
 | chart count as total by host,index
 | eval redCount = if(index=="main",total, 0) 
 | eval greenCount = if(index=="wineventlog", total, 0) 
 | fields host redCount greenCount
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However all hosts were returned with a 0 value.&lt;/P&gt;

&lt;P&gt;Any suggestions greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 01:02:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Chart-colors-by-search-values/m-p/496337#M138321</guid>
      <dc:creator>balcv</dc:creator>
      <dc:date>2019-10-01T01:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: Chart colors by search values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Chart-colors-by-search-values/m-p/496338#M138322</link>
      <description>&lt;P&gt;We can use table formatting of colors.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.3.1/Viz/TableFormatsFormatting"&gt;https://docs.splunk.com/Documentation/Splunk/7.3.1/Viz/TableFormatsFormatting&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Please check if this helps.&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Santosh&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 01:46:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Chart-colors-by-search-values/m-p/496338#M138322</guid>
      <dc:creator>santosh11</dc:creator>
      <dc:date>2019-10-01T01:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: Chart colors by search values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Chart-colors-by-search-values/m-p/496339#M138323</link>
      <description>&lt;P&gt;Hi  balcv,&lt;BR /&gt;
try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; (index="main" OR index="wineventlog") 
| stats count(eval(if(index=main,1,0))) AS redCount count(eval(if(index=wineventlog))) AS greeCount BY host
| table host redCount greenCount
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 09:34:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Chart-colors-by-search-values/m-p/496339#M138323</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-10-01T09:34:58Z</dc:date>
    </item>
    <item>
      <title>Re: Chart colors by search values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Chart-colors-by-search-values/m-p/496340#M138324</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Hi Balcv,&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I used index="_internal" since i haven't index="main" on my Splunk environment and just rename it to "index=main". Basically to answer your question, you can manually assign whatever color you want depending on the field name in your search. To do that you need to add new option name parameters for "charting.fieldColors" on your XML Dashboard.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;option name="charting.fieldColors"&amp;gt;{"wineventlog":0xFF0000, "main":0x008000}&amp;lt;/option&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Hex color values:&lt;/STRONG&gt;&lt;BR /&gt;
FF0000 = Red &lt;BR /&gt;
008000= Green&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Below is the search string i used.&lt;/STRONG&gt; &lt;/P&gt;

&lt;P&gt;index="_internal" OR index="wineventlog"&lt;BR /&gt;
| chart count AS total BY host, index&lt;BR /&gt;
| rename "VALUE_internal" AS "main"&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Try this full XML Code below so you can see and test it..&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard&amp;gt;
  &amp;lt;label&amp;gt;Column Chart (Manual change color depending on the field name on XML)&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;chart&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index="_internal" OR index="wineventlog"
| chart count AS total BY host, index
| rename "VALUE_internal" AS "main"&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-5m@m&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="charting.axisY.scale"&amp;gt;log&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart"&amp;gt;column&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.stackMode"&amp;gt;default&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.fieldColors"&amp;gt;{"wineventlog":0xFF0000, "main":0x008000}&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.legend.placement"&amp;gt;top&amp;lt;/option&amp;gt;
      &amp;lt;/chart&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;H2&gt;Let me know if this answer your question. Thanks&lt;/H2&gt;

&lt;P&gt;&lt;STRONG&gt;Kelz&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:22:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Chart-colors-by-search-values/m-p/496340#M138324</guid>
      <dc:creator>kelz</dc:creator>
      <dc:date>2020-09-30T02:22:04Z</dc:date>
    </item>
    <item>
      <title>Re: Chart colors by search values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Chart-colors-by-search-values/m-p/496341#M138325</link>
      <description>&lt;P&gt;Thanks @gcusello.  Unfortunatley this produced errors in the stats statement telling me the eval statement is invalid.  Thanks anyway.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 22:01:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Chart-colors-by-search-values/m-p/496341#M138325</guid>
      <dc:creator>balcv</dc:creator>
      <dc:date>2019-10-01T22:01:07Z</dc:date>
    </item>
    <item>
      <title>Re: Chart colors by search values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Chart-colors-by-search-values/m-p/496342#M138326</link>
      <description>&lt;P&gt;Will do.  Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 22:01:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Chart-colors-by-search-values/m-p/496342#M138326</guid>
      <dc:creator>balcv</dc:creator>
      <dc:date>2019-10-01T22:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: Chart colors by search values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Chart-colors-by-search-values/m-p/496343#M138327</link>
      <description>&lt;P&gt;After reviewing the various reposes (thank you all for contributing) and combing various aspects, I have been able to come up with the solution I was after.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; (index="main" OR index="wineventlog") 
    | stats count as total by host,index 
    | eval host=lower(host) 
    | sort host 
    | eval Linux = if(index=="main",total, 0) 
    | eval Windows = if(index=="wineventlog", total, 0) 
    | fields host Linux Windows
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This results in a column chart and when altering the formatting to be a stacked column chart and setting the colours&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;option name="charting.seriesColors"&amp;gt;[0xC53151,0x0066FF]&amp;lt;/option&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have the chart I was after showing the number of events per host with linux hosts in red and windows in blue.&lt;/P&gt;

&lt;P&gt;Again, thank you for your contributions. &lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 22:06:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Chart-colors-by-search-values/m-p/496343#M138327</guid>
      <dc:creator>balcv</dc:creator>
      <dc:date>2019-10-01T22:06:13Z</dc:date>
    </item>
  </channel>
</rss>

