<?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: Possible to achieve eval results per host? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Possible-to-achieve-eval-results-per-host/m-p/74069#M18609</link>
    <description>&lt;P&gt;Both answers work great, thanks!&lt;/P&gt;</description>
    <pubDate>Sat, 18 Feb 2012 01:32:58 GMT</pubDate>
    <dc:creator>geek238</dc:creator>
    <dc:date>2012-02-18T01:32:58Z</dc:date>
    <item>
      <title>Possible to achieve eval results per host?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Possible-to-achieve-eval-results-per-host/m-p/74066#M18606</link>
      <description>&lt;P&gt;Working with stat log events from DJB's dnscache.  These look like:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;@400000004f3ebb59244cc72c stats 275245265 10318311576 81 0&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;The first field is timestamp in tai64nlocal.  Splunk deals with that.  The first field after the 'stats' string is a query counter, constantly incrementing.  To get querys/second for the DNS resolver, I can do:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=dns earliest=-1m host=dns1 | rex field=_raw "stats\s(?&amp;lt;querycount&amp;gt;\d+) " | stats max(querycount) as hq,min(querycount) as lq | eval qps=(hq-lq)/60 | table host,qps,hq,lq
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I'd like to do is search against the index and execute stats and eval against values retrieved from each host observed in the index, without creating a separate search for each host.  I've been thinking something along the lines of finding hosts in a subsearch then for each value returned, execute the search to gather statistics.&lt;/P&gt;

&lt;P&gt;I'm sure someone has done something cool like this before.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2012 20:49:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Possible-to-achieve-eval-results-per-host/m-p/74066#M18606</guid>
      <dc:creator>geek238</dc:creator>
      <dc:date>2012-02-17T20:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to achieve eval results per host?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Possible-to-achieve-eval-results-per-host/m-p/74067#M18607</link>
      <description>&lt;P&gt;You can use &lt;CODE&gt;chart&lt;/CODE&gt; and then &lt;CODE&gt;eval()&lt;/CODE&gt; stuff directly inside of it, so something like this should work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=dns earliest=-1m host=dns1 | rex field=_raw "stats\s(?&amp;lt;querycount&amp;gt;\d+) " | chart eval((max(querycount)-min(querycount))/60) as qps,max(querycount) as hq,min(querycount) as lq by host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Feb 2012 21:39:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Possible-to-achieve-eval-results-per-host/m-p/74067#M18607</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2012-02-17T21:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to achieve eval results per host?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Possible-to-achieve-eval-results-per-host/m-p/74068#M18608</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=dns earliest=-1m host=dns1 
| rex field=_raw "stats\s(?&amp;lt;querycount&amp;gt;\d+) " 
| stats max(querycount) as hq,
        min(querycount) as lq 
  by host
| eval qps=(hq-lq)/60
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The "by" clause of the &lt;CODE&gt;stats&lt;/CODE&gt; command does what you want.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Feb 2012 00:09:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Possible-to-achieve-eval-results-per-host/m-p/74068#M18608</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2012-02-18T00:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: Possible to achieve eval results per host?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Possible-to-achieve-eval-results-per-host/m-p/74069#M18609</link>
      <description>&lt;P&gt;Both answers work great, thanks!&lt;/P&gt;</description>
      <pubDate>Sat, 18 Feb 2012 01:32:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Possible-to-achieve-eval-results-per-host/m-p/74069#M18609</guid>
      <dc:creator>geek238</dc:creator>
      <dc:date>2012-02-18T01:32:58Z</dc:date>
    </item>
  </channel>
</rss>

