<?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 How do I display percentage of 500 errors on a per-URI basis? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-display-percentage-of-500-errors-on-a-per-URI-basis/m-p/15789#M1996</link>
    <description>&lt;P&gt;So, I have a big set of web stats for a given time in a search. Basically, I want it broken down by uri_path and for each uri_path, it tells me the number of hits that were returning status 500.&lt;/P&gt;

&lt;P&gt;So, for example, let's say that I only had two uri_path values, as follows:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;
/fnord/hooray.cfm&lt;BR /&gt;
/dronf/test.cfm
&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;During the time frame, each of those only returned two status values: 200 and 500.&lt;/P&gt;

&lt;P&gt;Let's say there was 100 hits for /fnord/hooray.cfm, out of which 20 were 500 errors. At that same time, there were 200 hits for /dronf/test.cfm, 100 of which were 500 errors. Ideally, the resulting search would show something like this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;/fnord/horray.cfm  20 20%&lt;BR /&gt;
/fronf/test.cfm   100 50%&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Does that make sense? It seem like it would be easy to do this, but I'm not sure how. How get the search and/or report to do that?&lt;/P&gt;</description>
    <pubDate>Sat, 19 Jun 2010 01:48:54 GMT</pubDate>
    <dc:creator>kdankmyer</dc:creator>
    <dc:date>2010-06-19T01:48:54Z</dc:date>
    <item>
      <title>How do I display percentage of 500 errors on a per-URI basis?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-display-percentage-of-500-errors-on-a-per-URI-basis/m-p/15789#M1996</link>
      <description>&lt;P&gt;So, I have a big set of web stats for a given time in a search. Basically, I want it broken down by uri_path and for each uri_path, it tells me the number of hits that were returning status 500.&lt;/P&gt;

&lt;P&gt;So, for example, let's say that I only had two uri_path values, as follows:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;
/fnord/hooray.cfm&lt;BR /&gt;
/dronf/test.cfm
&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;During the time frame, each of those only returned two status values: 200 and 500.&lt;/P&gt;

&lt;P&gt;Let's say there was 100 hits for /fnord/hooray.cfm, out of which 20 were 500 errors. At that same time, there were 200 hits for /dronf/test.cfm, 100 of which were 500 errors. Ideally, the resulting search would show something like this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;/fnord/horray.cfm  20 20%&lt;BR /&gt;
/fronf/test.cfm   100 50%&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Does that make sense? It seem like it would be easy to do this, but I'm not sure how. How get the search and/or report to do that?&lt;/P&gt;</description>
      <pubDate>Sat, 19 Jun 2010 01:48:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-display-percentage-of-500-errors-on-a-per-URI-basis/m-p/15789#M1996</guid>
      <dc:creator>kdankmyer</dc:creator>
      <dc:date>2010-06-19T01:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: How do I display percentage of 500 errors on a per-URI basis?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-display-percentage-of-500-errors-on-a-per-URI-basis/m-p/15790#M1997</link>
      <description>&lt;P&gt;There are many different ways of accomplishing this search, but the one I find most intuitive and easily understood is to approach it like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | chart count(eval(status=500)) as internal_errors, count as total_requests by uri_path | eval perc=internal_error/total_requests
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here we use the count function of the chart command first to get counts of the two interesting values.&lt;/P&gt;

&lt;P&gt;First, we get the count of all events where status=500 and save that as a new field internal_errors. Second, we count the total number of requests as total_requests. And lastly, we tell Splunk to apply this chart command "by" uri_path (think group by).&lt;/P&gt;

&lt;P&gt;Now we just have counts of 500s and the total number of requests, so we add on the eval-command to actually get the percentile of internal_errors in relation to total_requests.  &lt;/P&gt;

&lt;P&gt;To get the output you are requesting, you can select the interesting fields by use of:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | fields uri_path, internal_errors, perc
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 19 Jun 2010 02:29:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-display-percentage-of-500-errors-on-a-per-URI-basis/m-p/15790#M1997</guid>
      <dc:creator>jwestberg</dc:creator>
      <dc:date>2010-06-19T02:29:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do I display percentage of 500 errors on a per-URI basis?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-display-percentage-of-500-errors-on-a-per-URI-basis/m-p/15791#M1998</link>
      <description>&lt;P&gt;In addition to jwestberg's answer, you can also use things like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | top limit=0 status by uri_path
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | stats count by status,uri_path | eventstats sum(count) as uri_total by uri_path | eval percent=count/uri_total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to get all statuses count and percentages. You can then add a &lt;CODE&gt;| where status=500&lt;/CODE&gt; or &lt;CODE&gt;| where status==500 OR status==200&lt;/CODE&gt; if you want to be selective about what statuses you're bringing back.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Jun 2010 11:23:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-display-percentage-of-500-errors-on-a-per-URI-basis/m-p/15791#M1998</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2010-06-19T11:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: How do I display percentage of 500 errors on a per-URI basis?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-display-percentage-of-500-errors-on-a-per-URI-basis/m-p/15792#M1999</link>
      <description>&lt;P&gt;Combining the two approaches above (thank you both) and experimenting a little, I ended up going with this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;... | stats count by status,uri_path | eventstats sum(count) as total_hits by uri_path | eval percent_errors=(count/total_hits)*100 | where status=500 | fields count, uri_path, percent_errors, total_hits | sort - count &lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2010 02:30:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-display-percentage-of-500-errors-on-a-per-URI-basis/m-p/15792#M1999</guid>
      <dc:creator>kdankmyer</dc:creator>
      <dc:date>2010-06-22T02:30:01Z</dc:date>
    </item>
  </channel>
</rss>

