<?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: Percentage of total on certain values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596542#M207670</link>
    <description>&lt;P&gt;Thnx for the attempt.&lt;BR /&gt;However, not yet exactly what I was thinking of?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ericvdhout_0-1651761995060.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/19453iE8D53B431BDFCAC9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ericvdhout_0-1651761995060.png" alt="ericvdhout_0-1651761995060.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 05 May 2022 14:46:42 GMT</pubDate>
    <dc:creator>ericvdhout</dc:creator>
    <dc:date>2022-05-05T14:46:42Z</dc:date>
    <item>
      <title>How to get the total of the events with an errorcode to appear as a percentage of the overall total of events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596521#M207666</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Am quite new to splunk so lease bear with me if I ask obvious questions. However things that were relatively simple in grafana (which we are coming from) seem uge tasks here in splunk. So I do hope someone can help me with the following ...&lt;BR /&gt;I have this index,&amp;nbsp; in whch a field, ms_result is extracted.&amp;nbsp; &amp;nbsp;This field can have numerous resultcodes. Only 2 of them are good ("OK" and "200-10000"). All other codes are errorcodes.&lt;/P&gt;
&lt;P&gt;Now I would like the total of the events with an errorcode to appear as a percentage of the overal total of events withing this search (per minute). So let's say, we have 1000 events, and 100 of them have an errorcode, then 10% should ben shown on the (area) graph.&lt;BR /&gt;&lt;BR /&gt;Below the picture I would like to recreate. Is this by any means possible?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ericvdhout_0-1651758428626.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/19446iEEF2646E6D06215A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ericvdhout_0-1651758428626.png" alt="ericvdhout_0-1651758428626.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Thnx&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 15:29:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596521#M207666</guid>
      <dc:creator>ericvdhout</dc:creator>
      <dc:date>2022-05-05T15:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage of total on certain values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596533#M207668</link>
      <description>&lt;LI-CODE lang="markup"&gt;| bin starttime as _time span=1m
| stats count as total count(eval(ms_result=="OK" OR ms_result=="200-10000")) as OK by _time
| eval errorpercentage=round(100*(total-OK)/total,2)
| fields - OK total&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 05 May 2022 14:29:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596533#M207668</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-05-05T14:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage of total on certain values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596542#M207670</link>
      <description>&lt;P&gt;Thnx for the attempt.&lt;BR /&gt;However, not yet exactly what I was thinking of?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ericvdhout_0-1651761995060.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/19453iE8D53B431BDFCAC9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ericvdhout_0-1651761995060.png" alt="ericvdhout_0-1651761995060.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 14:46:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596542#M207670</guid>
      <dc:creator>ericvdhout</dc:creator>
      <dc:date>2022-05-05T14:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage of total on certain values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596551#M207673</link>
      <description>&lt;P&gt;What was the search that produced that chart?&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 15:20:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596551#M207673</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-05-05T15:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the total of the events with an errorcode to appear as a percentage of the overall total of events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596555#M207676</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/245548"&gt;@ericvdhout&lt;/a&gt;&amp;nbsp;- Yeah very much possible to replicate that. I've done it multiple times.&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The first thing you need is a query.&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="markup"&gt;index=&amp;lt;your index&amp;gt; &amp;lt;is there anything else you would like to specify like sourcetype, etc&amp;gt;
| eval is_error=if(ms_result=="OK" OR ms_result=="200-10000", "OK", "Error")
| timechart count by is_error
| eval ErrorPerc = (Error/(OK+Error))*100
| eval OKPerc = (OK/(OK+Enter))*100
| fields - OK, Error&lt;/LI-CODE&gt;&lt;UL&gt;&lt;LI&gt;Second chart:&lt;UL&gt;&lt;LI&gt;Select Area chart.&lt;/LI&gt;&lt;LI&gt;Go to chart formatting and select stacked chart.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I hope this helps!!!!&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 15:51:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596555#M207676</guid>
      <dc:creator>VatsalJagani</dc:creator>
      <dc:date>2022-05-05T15:51:29Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage of total on certain values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596675#M207699</link>
      <description>&lt;LI-CODE lang="markup"&gt;index="aiam_apigw_app_idx" event_type="APIEND" |  bin starttime as _time span=1m
| stats count as total count(eval(ms_result=="OK" OR ms_result=="200-10000")) as OK by _time
| eval errorpercentage=round(100*(total-OK)/total,2)
| fields - OK total&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 06 May 2022 07:57:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596675#M207699</guid>
      <dc:creator>ericvdhout</dc:creator>
      <dc:date>2022-05-06T07:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the total of the events with an errorcode to appear as a percentage of the overall total of events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596681#M207700</link>
      <description>&lt;P&gt;OK,&lt;BR /&gt;Tried your suggestion, I guess I am doing something wrong.&lt;BR /&gt;&lt;BR /&gt;Looks like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ericvdhout_0-1651824669597.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/19484iB6898C930C95D6FD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ericvdhout_0-1651824669597.png" alt="ericvdhout_0-1651824669597.png" /&gt;&lt;/span&gt;&amp;nbsp;(for the record, this is roughly the same timeframe as the green/red graph I posted earlier)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the actual query:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="aiam_apigw_app_idx" event_type="APIEND"
| eval is_error=if(ms_result=="OK" OR ms_result=="200-10000", "OK", "Error")
| timechart count by is_error
| eval ErrorPerc = (Error/(OK+Error))*100
| eval OKPerc = (OK/(OK+Enter))*100
| fields - OK, Error&lt;/LI-CODE&gt;&lt;P&gt;I also chose stacked 100%&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 08:14:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596681#M207700</guid>
      <dc:creator>ericvdhout</dc:creator>
      <dc:date>2022-05-06T08:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the total of the events with an errorcode to appear as a percentage of the overall total of events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596684#M207702</link>
      <description>&lt;LI-CODE lang="markup"&gt;| eval OKPerc = (OK/(OK+Error))*100&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 06 May 2022 08:32:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596684#M207702</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-05-06T08:32:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the total of the events with an errorcode to appear as a percentage of the overall total of events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596692#M207709</link>
      <description>&lt;P&gt;OK,&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval OKPerc = (OK/(OK+Enter))*100&lt;/LI-CODE&gt;&lt;P&gt;should be&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval OKPerc = (OK/(OK+Error))*100&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This really looks like something.&lt;BR /&gt;Now, I tried to be smart and change&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| fields - OK, Error&lt;/LI-CODE&gt;&lt;P&gt;to&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| fields - Error, OK&lt;/LI-CODE&gt;&lt;P&gt;because I would like to have the errorlayer at the bottom. But this did not work. Is that possible?&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 08:50:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596692#M207709</guid>
      <dc:creator>ericvdhout</dc:creator>
      <dc:date>2022-05-06T08:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the total of the events with an errorcode to appear as a percentage of the overall total of events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596694#M207710</link>
      <description>&lt;P&gt;The chart starts at the top so the first listed series (field) appears at the top&lt;/P&gt;&lt;P&gt;There are two ways you could "fix" this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rename OKPerc as " OKPerc"&lt;/LI-CODE&gt;&lt;P&gt;so that the leading space takes precedence&lt;/P&gt;&lt;P&gt;or transpose, sort by name, transpose back&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| transpose 0 header_field=_time column_name=percent
| sort - percent
| transpose 0 header_field=percent column_name=_time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 09:00:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596694#M207710</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-05-06T09:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the total of the events with an errorcode to appear as a percentage of the overall total of events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596706#M207718</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/245548"&gt;@ericvdhout&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;&amp;nbsp;| fields -&lt;/STRONG&gt;&amp;nbsp;&lt;UL&gt;&lt;LI&gt;This is just to remove unnecessary fields that we don't need.&lt;/LI&gt;&lt;LI&gt;To &lt;STRONG&gt;order the results&lt;/STRONG&gt; you can use the &lt;STRONG&gt;table command&lt;/STRONG&gt; at the end of the query:&lt;UL&gt;&lt;LI&gt;| table _time, OK, Error&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;The only condition here is _time should be the first value.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="aiam_apigw_app_idx" event_type="APIEND"
| eval is_error=if(ms_result=="OK" OR ms_result=="200-10000", "OK", "Error")
| timechart count by is_error
| eval ErrorPerc = (Error/(OK+Error))*100
| eval OKPerc = (OK/(OK+Error))*100
| table _time, OKPerc, ErrorPerc&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps!!!&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 10:06:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596706#M207718</guid>
      <dc:creator>VatsalJagani</dc:creator>
      <dc:date>2022-05-06T10:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the total of the events with an errorcode to appear as a percentage of the overall total of events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596712#M207720</link>
      <description>&lt;P&gt;That wen surprisingly well &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;This is almost what I wanted to see. Thnx&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;(however, I consider the table posiibility Vatsaljagani mentioned a more elegant solution.)&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 10:24:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596712#M207720</guid>
      <dc:creator>ericvdhout</dc:creator>
      <dc:date>2022-05-06T10:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the total of the events with an errorcode to appear as a percentage of the overall total of events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596714#M207721</link>
      <description>&lt;P&gt;certainly helps.&lt;BR /&gt;&lt;BR /&gt;You do not, by accidnt, happen to know how I can change the colors of the 2 fields?&lt;BR /&gt;&lt;BR /&gt;All over the net I see ways to change it in xml in the source, however I have no xml in the source, merely lookss like json.&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 10:26:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596714#M207721</guid>
      <dc:creator>ericvdhout</dc:creator>
      <dc:date>2022-05-06T10:26:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the total of the events with an errorcode to appear as a percentage of the overall total of events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596717#M207722</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/245548"&gt;@ericvdhout&lt;/a&gt;&amp;nbsp;- If you have JSON then you are using the new Dashboard Studio framework.&lt;/P&gt;&lt;P&gt;Try the field&amp;nbsp;&lt;STRONG&gt;fieldColors&lt;/STRONG&gt; option, something like this format with your chart:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{"OK": "#ff0000","Error": "#cb3b43"}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Reference -&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.6/DashStudio/chartsArea" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.2.6/DashStudio/chartsArea&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 10:50:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596717#M207722</guid>
      <dc:creator>VatsalJagani</dc:creator>
      <dc:date>2022-05-06T10:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the total of the events with an errorcode to appear as a percentage of the overall total of events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596727#M207726</link>
      <description>&lt;P&gt;True, the table solution works well when you know the field names (which you do in this instance), the transpose and sort method works when the column names are unknown / indeterminant&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 11:47:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596727#M207726</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-05-06T11:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the total of the events with an errorcode to appear as a percentage of the overall total of events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596923#M207778</link>
      <description>&lt;P&gt;Cool, thank you, Am going to dive into that.&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 10:56:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596923#M207778</guid>
      <dc:creator>ericvdhout</dc:creator>
      <dc:date>2022-05-09T10:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the total of the events with an errorcode to appear as a percentage of the overall total of events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596970#M207797</link>
      <description>&lt;P&gt;Well, That did not work the way I wanted, but I will ask an extra question for that, for it is kind of offtopic for here.&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 13:51:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-total-of-the-events-with-an-errorcode-to-appear/m-p/596970#M207797</guid>
      <dc:creator>ericvdhout</dc:creator>
      <dc:date>2022-05-09T13:51:50Z</dc:date>
    </item>
  </channel>
</rss>

