<?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 search for a Term, then get the Percentage out of Total? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-for-a-Term-then-get-the-Percentage-out-of-Total/m-p/77318#M19538</link>
    <description>&lt;P&gt;I'm writing a search query that needs to look for a specific word SPECIFIC_WORD in the logs of host HOST_X and then determine how many times that searched term comes up when compared to overall.  Looking for something along the lines of:&lt;/P&gt;

&lt;P&gt;1) search: host='HOST_X' =&amp;gt; it will yield to say 100 results&lt;BR /&gt;
2) search: host='HOST_X' "SPECIFC_WORD" =&amp;gt; it will yield to say 20 results&lt;BR /&gt;
3) do a percentage out of total =&amp;gt; 20%&lt;BR /&gt;
4) be able to do the best graph by date_hour of step_2/step_1&lt;/P&gt;

&lt;P&gt;I've done something like that already:&lt;/P&gt;

&lt;P&gt;host="HOST_X" | stats count as total by date_hour | join [search host="HOST_X" "SPECIFIC_WORD" | stats count as something by date_hour] | eval percent_out_of=(something/total)*100 &lt;/P&gt;

&lt;P&gt;That seems to give me what I'm looking for, but only see total in the graph. It could be that the total number is just too large, but I'm not sure)&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 14:52:07 GMT</pubDate>
    <dc:creator>mkarimi</dc:creator>
    <dc:date>2020-09-28T14:52:07Z</dc:date>
    <item>
      <title>How do I search for a Term, then get the Percentage out of Total?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-for-a-Term-then-get-the-Percentage-out-of-Total/m-p/77318#M19538</link>
      <description>&lt;P&gt;I'm writing a search query that needs to look for a specific word SPECIFIC_WORD in the logs of host HOST_X and then determine how many times that searched term comes up when compared to overall.  Looking for something along the lines of:&lt;/P&gt;

&lt;P&gt;1) search: host='HOST_X' =&amp;gt; it will yield to say 100 results&lt;BR /&gt;
2) search: host='HOST_X' "SPECIFC_WORD" =&amp;gt; it will yield to say 20 results&lt;BR /&gt;
3) do a percentage out of total =&amp;gt; 20%&lt;BR /&gt;
4) be able to do the best graph by date_hour of step_2/step_1&lt;/P&gt;

&lt;P&gt;I've done something like that already:&lt;/P&gt;

&lt;P&gt;host="HOST_X" | stats count as total by date_hour | join [search host="HOST_X" "SPECIFIC_WORD" | stats count as something by date_hour] | eval percent_out_of=(something/total)*100 &lt;/P&gt;

&lt;P&gt;That seems to give me what I'm looking for, but only see total in the graph. It could be that the total number is just too large, but I'm not sure)&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:52:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-for-a-Term-then-get-the-Percentage-out-of-Total/m-p/77318#M19538</guid>
      <dc:creator>mkarimi</dc:creator>
      <dc:date>2020-09-28T14:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: How do I search for a Term, then get the Percentage out of Total?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-for-a-Term-then-get-the-Percentage-out-of-Total/m-p/77319#M19539</link>
      <description>&lt;P&gt;Actually, you should be able to do this without a join.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;host="HOST_X" | eval does_match = if(searchmatch("SPECIFIC_WORD"),1,0) | stats sum(does_match) as Specific_Word count as Total by date_hour | eval percent_out_of = (Specific_Word/count)*100&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2013 21:55:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-for-a-Term-then-get-the-Percentage-out-of-Total/m-p/77319#M19539</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2013-09-30T21:55:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do I search for a Term, then get the Percentage out of Total?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-for-a-Term-then-get-the-Percentage-out-of-Total/m-p/77320#M19540</link>
      <description>&lt;P&gt;thanks for the help.  Is it possible to show them both in the same time vs count column graph? I know I can change the graph type but it shows them next to each other in the column graph instead of the same column.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2013 16:33:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-search-for-a-Term-then-get-the-Percentage-out-of-Total/m-p/77320#M19540</guid>
      <dc:creator>mkarimi</dc:creator>
      <dc:date>2013-10-02T16:33:09Z</dc:date>
    </item>
  </channel>
</rss>

