<?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 by field with search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Percentage-by-field-with-search/m-p/692783#M235785</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/269797"&gt;@Idodox&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;please see this approach:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;unrelated part to collect proper events&amp;gt; error=4
| eventstats count as total by applicationId
| search error=404
| stats count as error_404 values(total) AS total by applicationId
| eval errorRate=((error_404/total)*100)."%"
| table applicationId, errorRate&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Tue, 09 Jul 2024 16:14:21 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2024-07-09T16:14:21Z</dc:date>
    <item>
      <title>Percentage by field with search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Percentage-by-field-with-search/m-p/692779#M235784</link>
      <description>&lt;P&gt;I'm trying to get a percentage of a field, based on a condition (filtered by search) by another field.&lt;/P&gt;&lt;P&gt;e.g.&amp;nbsp; percentage of 404 errors by application. So need to get the total number of requests for each application, filter to keep only 404 errors then count by application. At least that's the logic I used.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;unrelated part to collect proper events&amp;gt;
| eventstats count as total by applicationId
| search error=404
| stats count as error_404 by applicationId
| eval errorRate=((error_404/total)*100)."%"
| table applicationId, errorRate&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This returns a list of applications, but no values for errorRate.&lt;BR /&gt;Individually, I'm able to get a result for this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats count as total by applicationId&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;And also for this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| search error=404
| stats count as error_404 by applicationId&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;But something in having them together in the flow I have doesn't work.&lt;BR /&gt;&lt;BR /&gt;I also tried this which didn't work. In this instance I get values for applicationId and total. So I guess there's something wrong with how I'm getting the error_404 values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats count as total by applicationId
| appendcols[search error=404|stats count as error_404 by applicationId]
| eval errorRate=((error_404/total)*100)."%"
| table applicationId, error_404, total, errorRate&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 16:06:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Percentage-by-field-with-search/m-p/692779#M235784</guid>
      <dc:creator>Idodox</dc:creator>
      <dc:date>2024-07-09T16:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage by field with search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Percentage-by-field-with-search/m-p/692783#M235785</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/269797"&gt;@Idodox&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;please see this approach:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;unrelated part to collect proper events&amp;gt; error=4
| eventstats count as total by applicationId
| search error=404
| stats count as error_404 values(total) AS total by applicationId
| eval errorRate=((error_404/total)*100)."%"
| table applicationId, errorRate&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 16:14:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Percentage-by-field-with-search/m-p/692783#M235785</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-07-09T16:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage by field with search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Percentage-by-field-with-search/m-p/692828#M235806</link>
      <description>&lt;P&gt;Works beautifully. Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 22:11:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Percentage-by-field-with-search/m-p/692828#M235806</guid>
      <dc:creator>Idodox</dc:creator>
      <dc:date>2024-07-09T22:11:18Z</dc:date>
    </item>
  </channel>
</rss>

