<?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 Eval results compared to Total counts in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Eval-results-compared-to-Total-counts/m-p/387821#M171040</link>
    <description>&lt;P&gt;I would like to display all Bot and Crawler activity compared to the total amount of events.&lt;/P&gt;

&lt;P&gt;index="Web" &lt;BR /&gt;
| eval WebTraffic=if(match(http_user_agent, "(?i)bot"), "Bots", WebTraffic) &lt;BR /&gt;
| eval WebTraffic=if(match(http_user_agent, "(?i)crawl"), "Crawlers", WebTraffic) &lt;BR /&gt;
| top WebTraffic&lt;/P&gt;

&lt;P&gt;This provides a clear display of my Bots and Crawlers count but I would like to show what percentage the counts represent in comparison to all activity within the same time. For example per hour, my Bots are around 5000 events with Crawlers around 10,000, I'm simply looking for a way to show those numbers next to the total 100,000 of activity for the same hour.&lt;/P&gt;

&lt;P&gt;Any thoughts on how to make this happen are appreciated.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 00:41:03 GMT</pubDate>
    <dc:creator>jon_marcum</dc:creator>
    <dc:date>2020-09-30T00:41:03Z</dc:date>
    <item>
      <title>Eval results compared to Total counts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-results-compared-to-Total-counts/m-p/387821#M171040</link>
      <description>&lt;P&gt;I would like to display all Bot and Crawler activity compared to the total amount of events.&lt;/P&gt;

&lt;P&gt;index="Web" &lt;BR /&gt;
| eval WebTraffic=if(match(http_user_agent, "(?i)bot"), "Bots", WebTraffic) &lt;BR /&gt;
| eval WebTraffic=if(match(http_user_agent, "(?i)crawl"), "Crawlers", WebTraffic) &lt;BR /&gt;
| top WebTraffic&lt;/P&gt;

&lt;P&gt;This provides a clear display of my Bots and Crawlers count but I would like to show what percentage the counts represent in comparison to all activity within the same time. For example per hour, my Bots are around 5000 events with Crawlers around 10,000, I'm simply looking for a way to show those numbers next to the total 100,000 of activity for the same hour.&lt;/P&gt;

&lt;P&gt;Any thoughts on how to make this happen are appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:41:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-results-compared-to-Total-counts/m-p/387821#M171040</guid>
      <dc:creator>jon_marcum</dc:creator>
      <dc:date>2020-09-30T00:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: Eval results compared to Total counts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-results-compared-to-Total-counts/m-p/387822#M171041</link>
      <description>&lt;P&gt;Hi @jon_marcum &lt;/P&gt;

&lt;P&gt;How about this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="Web"
| eval WebTraffic=if(match(http_user_agent, "(?i)bot"), "Bots", WebTraffic) 
| eval WebTraffic=if(match(http_user_agent, "(?i)crawl"), "Crawlers", WebTraffic) 
| bin _time span=1h
| top WebTraffic by _time
| chart avg(count) as count, avg(percent) as percent over _time by WebTraffic
| addtotals "count: WebTraffic" "count: Bots" "count: Crawlers"
| fields _time "count: WebTraffic" "count: Bots" "count: Crawlers" Total "percent: Bots" "percent: Crawlers"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I hope this would be some of help.&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2019 06:05:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-results-compared-to-Total-counts/m-p/387822#M171041</guid>
      <dc:creator>soskaykakehi</dc:creator>
      <dc:date>2019-05-28T06:05:52Z</dc:date>
    </item>
    <item>
      <title>Re: Eval results compared to Total counts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-results-compared-to-Total-counts/m-p/387823#M171042</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="Web"
| eval WebTraffic = case(match(http_user_agent, "(?i)bot"), "Bots",match(http_user_agent, "(?i)crawl"), "Crawlers",1=1,"Users")
| stats count as total_count, count(eval(WebTraffic="Bots")) as bot_count, count(eval(WebTraffic="Crawlers")) as crawler_count
| eval bot_percent=round((bot_count/total_count)*100,2)
| eval crawler_percent=round((crawler_count/total_count)*100,2)
| table total_count, bot_count, bot_percent, crawler_count, crawler_percent
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 May 2019 10:44:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-results-compared-to-Total-counts/m-p/387823#M171042</guid>
      <dc:creator>DMohn</dc:creator>
      <dc:date>2019-05-28T10:44:27Z</dc:date>
    </item>
    <item>
      <title>Re: Eval results compared to Total counts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-results-compared-to-Total-counts/m-p/387824#M171043</link>
      <description>&lt;P&gt;That's perfect, thanks for the help.&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2019 13:29:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-results-compared-to-Total-counts/m-p/387824#M171043</guid>
      <dc:creator>jon_marcum</dc:creator>
      <dc:date>2019-05-28T13:29:53Z</dc:date>
    </item>
  </channel>
</rss>

