<?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 create splunk query to get the total percentage of the two results in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-splunk-query-to-get-the-total-percentage-of-the/m-p/484458#M193431</link>
    <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="pihole:log*"  tag=dns tag=network tag=resolution 
|stats count as total, count(eval(query_type="blocked") as blocked 
|eval percent=round((blocked/total)* 100,1)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 29 Feb 2020 11:35:10 GMT</pubDate>
    <dc:creator>nickhills</dc:creator>
    <dc:date>2020-02-29T11:35:10Z</dc:date>
    <item>
      <title>How do I create splunk query to get the total percentage of the two results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-splunk-query-to-get-the-total-percentage-of-the/m-p/484457#M193430</link>
      <description>&lt;P&gt;I'm new to splunk and need further guidance to be able to accomplish my dashboard for Pi-Hole:&lt;/P&gt;

&lt;P&gt;Could some expert guide me how?&lt;/P&gt;

&lt;P&gt;Queries Blocked&lt;BR /&gt;
tag=dns tag=network tag=resolution query_type=blocked |stats count&lt;/P&gt;

&lt;P&gt;Total Queries&lt;BR /&gt;
sourcetype="pihole:log*" tag=dns tag=network tag=resolution query |stats count&lt;/P&gt;

&lt;P&gt;How do I create splunk query to get the total percentage of the two results&lt;BR /&gt;
Queries Blocked/Total queries x 100 = ?&lt;/P&gt;

&lt;P&gt;I just need the exact value so i can just simply copy and paste the good answer here to my splunk field.&lt;/P&gt;

&lt;P&gt;Your input is highly appreciated.&lt;/P&gt;</description>
      <pubDate>Sat, 29 Feb 2020 10:48:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-splunk-query-to-get-the-total-percentage-of-the/m-p/484457#M193430</guid>
      <dc:creator>rodrigrc</dc:creator>
      <dc:date>2020-02-29T10:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create splunk query to get the total percentage of the two results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-splunk-query-to-get-the-total-percentage-of-the/m-p/484458#M193431</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="pihole:log*"  tag=dns tag=network tag=resolution 
|stats count as total, count(eval(query_type="blocked") as blocked 
|eval percent=round((blocked/total)* 100,1)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 29 Feb 2020 11:35:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-splunk-query-to-get-the-total-percentage-of-the/m-p/484458#M193431</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2020-02-29T11:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create splunk query to get the total percentage of the two results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-splunk-query-to-get-the-total-percentage-of-the/m-p/484459#M193432</link>
      <description>&lt;P&gt;if i put this search query, i get the correct total no output, but with "zero" blocked output.&lt;BR /&gt;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++&lt;BR /&gt;
sourcetype="pihole:log"  tag=dns tag=network tag=resolution message_type="Query"&lt;BR /&gt;
 |stats count as total, count(eval(query_type="Blocked")) as blocked &lt;BR /&gt;
 |eval percent=round((blocked/total)* 100,1)&lt;/P&gt;

&lt;P&gt;total   blocked percent&lt;BR /&gt;
20433   0   0.0&lt;BR /&gt;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++&lt;/P&gt;

&lt;P&gt;And below results shows the correct no. of blocked outputs, but too many entries outputs&lt;BR /&gt;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++&lt;BR /&gt;
sourcetype="pihole:log"  tag=dns tag=network tag=resolution&lt;BR /&gt;
 |stats count as total, count(eval(query_type="Blocked")) as blocked &lt;BR /&gt;
 |eval percent=round((blocked/total)* 100,1)&lt;/P&gt;

&lt;P&gt;total   blocked percent&lt;BR /&gt;
91921   3683    4.0&lt;BR /&gt;
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:26:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-splunk-query-to-get-the-total-percentage-of-the/m-p/484459#M193432</guid>
      <dc:creator>rodrigrc</dc:creator>
      <dc:date>2020-09-30T04:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create splunk query to get the total percentage of the two results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-splunk-query-to-get-the-total-percentage-of-the/m-p/484460#M193433</link>
      <description>&lt;P&gt;message_type="Query" does not have &lt;CODE&gt;query_type="Blocked"&lt;/CODE&gt;&lt;BR /&gt;
and many &lt;CODE&gt;message_type&lt;/CODE&gt; have &lt;CODE&gt;query_type="Blocked"&lt;/CODE&gt; &lt;BR /&gt;
you only know your logs. good luck.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:22:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-splunk-query-to-get-the-total-percentage-of-the/m-p/484460#M193433</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-09-30T04:22:52Z</dc:date>
    </item>
  </channel>
</rss>

