<?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: stats count help in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/stats-count-help/m-p/273276#M82360</link>
    <description>&lt;P&gt;Either your &lt;CODE&gt;method&lt;/CODE&gt; field or your &lt;CODE&gt;dv_ip&lt;/CODE&gt; field is not there.  Back of your commands from the end one-by-one until you see stuff that works and then figure out why the stuff you just stripped isn't working.  Probably bad RegEx.&lt;/P&gt;</description>
    <pubDate>Sun, 03 Apr 2016 18:14:42 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2016-04-03T18:14:42Z</dc:date>
    <item>
      <title>stats count help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-count-help/m-p/273274#M82358</link>
      <description>&lt;P&gt;I am pulling syslogs and attempting to count IPs that are blocked for abuse.  My counts are coming up 0.  the IP used has been banned by two devices in the last 48hrs, and more than once in one of the devices. here is my xml search query so far;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=aaa source=tcp:5146 NetworkDeviceName=*SOME-ROUTER* BAD-CUST 10.20.30.40 AND NOT "no ip prefix-list" AND NOT "show ip prefix-list" AND NOT "do sh" | rex field=CmdSet mode=sed "s/\[ CmdAV=//g" | rex field=CmdSet mode=sed "s/\]//g" | rex field=CmdSet "permit (?&amp;lt;dvc_ip&amp;gt;\d+\.\d+\.\d+\.\d+)\/32" | rename dvc_ip as "IP Blocked" | stats count(eval(method="48HRs")) AS 48HRs BY "IP Blocked" NetworkDeviceName 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and the result im trying to achieve;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;IP blocked NetworkDeviceName 48HRs
10.20.30.40 one-some-router 2
10.20.30.40 two-some-router 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks for any suggestions&lt;/P&gt;</description>
      <pubDate>Sun, 03 Apr 2016 17:58:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-count-help/m-p/273274#M82358</guid>
      <dc:creator>hermeslxxv</dc:creator>
      <dc:date>2016-04-03T17:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: stats count help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-count-help/m-p/273275#M82359</link>
      <description>&lt;P&gt;Can you share some sample events?&lt;/P&gt;</description>
      <pubDate>Sun, 03 Apr 2016 18:01:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-count-help/m-p/273275#M82359</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-04-03T18:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: stats count help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-count-help/m-p/273276#M82360</link>
      <description>&lt;P&gt;Either your &lt;CODE&gt;method&lt;/CODE&gt; field or your &lt;CODE&gt;dv_ip&lt;/CODE&gt; field is not there.  Back of your commands from the end one-by-one until you see stuff that works and then figure out why the stuff you just stripped isn't working.  Probably bad RegEx.&lt;/P&gt;</description>
      <pubDate>Sun, 03 Apr 2016 18:14:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-count-help/m-p/273276#M82360</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-04-03T18:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: stats count help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-count-help/m-p/273277#M82361</link>
      <description>&lt;P&gt;something specific that would help?  the CmdSet field is what im searching against, in this case it is identical for all the events aside from a time stamp and the device name.&lt;/P&gt;

&lt;P&gt;Feb 15 02:05:29,CmdSet=[ CmdAV=ip prefix-list BAD-CUST seq 1 permit 10.20.30.40/32  ], NetworkDeviceName=ONE-SOME-ROUTER&lt;BR /&gt;
Feb 15 02:05:29,CmdSet=[ CmdAV=ip prefix-list BAD-CUST seq 1 permit 10.20.30.40/32  ], NetworkDeviceName=TWO-SOME-ROUTER&lt;BR /&gt;
Feb 10 04:02:11,CmdSet=[ CmdAV=ip prefix-list BAD-CUST seq 1 permit 10.20.30.40/32  ], NetworkDeviceName=ONE-SOME-ROUTER&lt;/P&gt;</description>
      <pubDate>Sun, 03 Apr 2016 18:18:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-count-help/m-p/273277#M82361</guid>
      <dc:creator>hermeslxxv</dc:creator>
      <dc:date>2016-04-03T18:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: stats count help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-count-help/m-p/273278#M82362</link>
      <description>&lt;P&gt;Additionally to backtracking commands, I'd recommend using &lt;CODE&gt;search&lt;/CODE&gt; or &lt;CODE&gt;where&lt;/CODE&gt; commands to filter for the &lt;CODE&gt;method&lt;/CODE&gt; value rather than stuffing too much logic into &lt;CODE&gt;stats&lt;/CODE&gt; - that quickly becomes hard to debug.&lt;/P&gt;</description>
      <pubDate>Sun, 03 Apr 2016 21:51:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-count-help/m-p/273278#M82362</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2016-04-03T21:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: stats count help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-count-help/m-p/273279#M82363</link>
      <description>&lt;P&gt;method field is missing. Can you check once by backtracing before rex and printing out method. Rex looks fine to me, but do check the results once.&lt;BR /&gt;
Backtracing is the only way to debug your queries &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 09:15:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-count-help/m-p/273279#M82363</guid>
      <dc:creator>meenal901</dc:creator>
      <dc:date>2016-04-08T09:15:35Z</dc:date>
    </item>
  </channel>
</rss>

