<?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 I write a search to calculate the percentage of each status field in my sample data? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-a-search-to-calculate-the-percentage-of-each/m-p/216722#M63628</link>
    <description>&lt;P&gt;Examples in our docs here  - &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.2/SearchReference/Top"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.2/SearchReference/Top&lt;/A&gt;  &lt;/P&gt;</description>
    <pubDate>Thu, 07 Jan 2016 11:58:09 GMT</pubDate>
    <dc:creator>sdaniels</dc:creator>
    <dc:date>2016-01-07T11:58:09Z</dc:date>
    <item>
      <title>How do I write a search to calculate the percentage of each status field in my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-a-search-to-calculate-the-percentage-of-each/m-p/216719#M63625</link>
      <description>&lt;P&gt;Working on some client data, sample data format looks like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Item    status
--------------------------
AAA  success
BBB  fail
CCC     pending
DDD  fail
EEE  success
FFF  success
GGG  pending
HHH  success
III  fail
JJJ  pending
KKK  success
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now I want to calculate the percentage of each status field. &lt;BR /&gt;
I want the output like below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;status     count    percentage
-----------------------------------
Success    50      50%
fail       40      40%
pending    10      10%
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;plz help me with search.&lt;/P&gt;

&lt;P&gt;Thanks in advance..&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2016 07:29:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-a-search-to-calculate-the-percentage-of-each/m-p/216719#M63625</guid>
      <dc:creator>SrinivasaC</dc:creator>
      <dc:date>2016-01-07T07:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write a search to calculate the percentage of each status field in my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-a-search-to-calculate-the-percentage-of-each/m-p/216720#M63626</link>
      <description>&lt;P&gt;It should be something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yoursearch | top status
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Jan 2016 10:22:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-a-search-to-calculate-the-percentage-of-each/m-p/216720#M63626</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-01-07T10:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write a search to calculate the percentage of each status field in my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-a-search-to-calculate-the-percentage-of-each/m-p/216721#M63627</link>
      <description>&lt;P&gt;try like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| stats count   by status| eventstats sum(count) as total| eval percent = round((count/total)*100) . " %"|sort -percent | fields - total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| top status | eval percent=percent."%"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Jan 2016 10:58:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-a-search-to-calculate-the-percentage-of-each/m-p/216721#M63627</guid>
      <dc:creator>fdi01</dc:creator>
      <dc:date>2016-01-07T10:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write a search to calculate the percentage of each status field in my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-a-search-to-calculate-the-percentage-of-each/m-p/216722#M63628</link>
      <description>&lt;P&gt;Examples in our docs here  - &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.2/SearchReference/Top"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.2/SearchReference/Top&lt;/A&gt;  &lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2016 11:58:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-a-search-to-calculate-the-percentage-of-each/m-p/216722#M63628</guid>
      <dc:creator>sdaniels</dc:creator>
      <dc:date>2016-01-07T11:58:09Z</dc:date>
    </item>
  </channel>
</rss>

