<?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: Is there a way to &amp;quot;speed up&amp;quot; this search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-quot-speed-up-quot-this-search/m-p/167988#M47885</link>
    <description>&lt;P&gt;Thanks, do you mean like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(sourcetype="firewall" OR sourcetype="ips") (dest_port="21" OR dest_port="22" OR dest_port="3389") (action="blocked" OR action="denied") NOT  (dest_ip="10.0.0.0/8" OR dest_ip="172.16.0.0/12" OR dest_ip="192.168.0.0/16") | iplocation dest_ip | stats dc(_raw) as Count by src_ip dest_ip Country Region City dest_port protocol sourcetype signature | sort -Count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 16 May 2014 18:50:22 GMT</pubDate>
    <dc:creator>echojacques</dc:creator>
    <dc:date>2014-05-16T18:50:22Z</dc:date>
    <item>
      <title>Is there a way to "speed up" this search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-quot-speed-up-quot-this-search/m-p/167985#M47882</link>
      <description>&lt;P&gt;Outside of creating an accelerated search or upgrading hardware, is there a way to speed up the search below?  This search takes approximately an hour to run on my system and I'm wondering if it's because my search logic is inefficient and if my search syntax/logic can be improved somehow?  The search detects denied/blocked outbound remote connections (FTP, SSH, RDP).  Thanks!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(sourcetype="firewall" OR sourcetype="ips") (dest_port="21" OR dest_port="22" OR dest_port="3389") (action="blocked" OR action="denied") (dest_ip!="10.0.0.0/8" AND dest_ip!="172.16.0.0/12" AND dest_ip!="192.168.0.0/16") | iplocation dest_ip | stats dc(_raw) as Count by src_ip dest_ip Country Region City dest_port protocol sourcetype signature | sort -Count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 May 2014 15:47:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-quot-speed-up-quot-this-search/m-p/167985#M47882</guid>
      <dc:creator>echojacques</dc:creator>
      <dc:date>2014-05-16T15:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to "speed up" this search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-quot-speed-up-quot-this-search/m-p/167986#M47883</link>
      <description>&lt;P&gt;Hi echojacques,&lt;/P&gt;

&lt;P&gt;Maybe it helps if you use an index in your search, else the search will use all your defaults indexes.&lt;BR /&gt;
Also, try to aviod != because this is not the same like NOT. &lt;/P&gt;

&lt;P&gt;With != it is implied that the field exists, but does not have the specified value. If the field is not found at all in the event, the search will not match.&lt;BR /&gt;
NOT field= will check if the field has the specified value and if it doesn't, it will match.&lt;/P&gt;

&lt;P&gt;Hope this helps ....&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2014 17:48:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-quot-speed-up-quot-this-search/m-p/167986#M47883</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-05-16T17:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to "speed up" this search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-quot-speed-up-quot-this-search/m-p/167987#M47884</link>
      <description>&lt;P&gt;Also, try moving the iplocation call after the stats.&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2014 18:09:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-quot-speed-up-quot-this-search/m-p/167987#M47884</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-05-16T18:09:27Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to "speed up" this search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-quot-speed-up-quot-this-search/m-p/167988#M47885</link>
      <description>&lt;P&gt;Thanks, do you mean like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(sourcetype="firewall" OR sourcetype="ips") (dest_port="21" OR dest_port="22" OR dest_port="3389") (action="blocked" OR action="denied") NOT  (dest_ip="10.0.0.0/8" OR dest_ip="172.16.0.0/12" OR dest_ip="192.168.0.0/16") | iplocation dest_ip | stats dc(_raw) as Count by src_ip dest_ip Country Region City dest_port protocol sourcetype signature | sort -Count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 May 2014 18:50:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-quot-speed-up-quot-this-search/m-p/167988#M47885</guid>
      <dc:creator>echojacques</dc:creator>
      <dc:date>2014-05-16T18:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to "speed up" this search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-quot-speed-up-quot-this-search/m-p/167989#M47886</link>
      <description>&lt;P&gt;Yes and add &lt;CODE&gt;index=foo OR index=boo&lt;/CODE&gt; if possible&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2014 18:57:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-quot-speed-up-quot-this-search/m-p/167989#M47886</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-05-16T18:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to "speed up" this search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-quot-speed-up-quot-this-search/m-p/167990#M47887</link>
      <description>&lt;P&gt;Ok, did that and for whatever reason, I don't get any results when using NOT.  When using != then I get some valid results...&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2014 19:13:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-quot-speed-up-quot-this-search/m-p/167990#M47887</guid>
      <dc:creator>echojacques</dc:creator>
      <dc:date>2014-05-16T19:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to "speed up" this search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-quot-speed-up-quot-this-search/m-p/167991#M47888</link>
      <description>&lt;P&gt;just saw that you used in the first posted search &lt;CODE&gt;(dest_ip!="10.0.0.0/8" AND dest_ip!="172.16.0.0/12" AND dest_ip!="192.168.0.0/16")&lt;/CODE&gt; and now it is &lt;CODE&gt;(dest_ip="10.0.0.0/8" OR dest_ip="172.16.0.0/12" OR dest_ip="192.168.0.0/16")&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;The first search used AND, but now you use OR ...&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2014 19:21:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-quot-speed-up-quot-this-search/m-p/167991#M47888</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-05-16T19:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to "speed up" this search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-quot-speed-up-quot-this-search/m-p/167992#M47889</link>
      <description>&lt;P&gt;I just did something very similar to this for our firewall logs (I am doing almost the exact same thing as you here), I was able to speed up a search  run time for a 30 day search from many many hours to a few seconds using an accelerated data model.&lt;/P&gt;

&lt;P&gt;Create a new data model named "firewall_events", and Add Object -&amp;gt; Root Event named "firewall_events" with constraints (possibly also include indexes as MuS suggests):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(sourcetype="firewall" OR sourcetype="ips") (dest_port="21" OR dest_port="22" OR dest_port="3389") (action="blocked" OR action="denied") (dest_ip!="10.0.0.0/8" AND dest_ip!="172.16.0.0/12" AND dest_ip!="192.168.0.0/16")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Next, add the fields you want with "Add Attribute &amp;gt; Auto-extracted", and pick out the fields you need.  Turn on acceleration over the time interval you want to search (30 days for me).&lt;/P&gt;

&lt;P&gt;Last, search thusly:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| pivot firewall_events firewall_events count(firewall_events) AS "Count" SPLITROW src_ip AS "src_ip" SPLITROW dst_ip AS "dest_ip" SPLITROW sourcetype AS "sourcetype" SORT 0 src_ip | iplocation dest_ip | sort - Count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I haven't quite gotten the hang of the pivot command syntax yet, so I did that part in the pivot editor and then clicked "Open in Search" to finish the rest of the query. &lt;/P&gt;

&lt;P&gt;You may have to wait a few hours for the acceleration to build before you see the full speedup.&lt;/P&gt;

&lt;P&gt;Good luck!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:38:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-quot-speed-up-quot-this-search/m-p/167992#M47889</guid>
      <dc:creator>rmdfrb</dc:creator>
      <dc:date>2020-09-28T16:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to "speed up" this search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-quot-speed-up-quot-this-search/m-p/167993#M47890</link>
      <description>&lt;P&gt;Correct, I tried OR since I got incorrect results with AND.  AND produced lots of results with the dest_ip ranges that I was trying to exclude...&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2014 19:32:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-quot-speed-up-quot-this-search/m-p/167993#M47890</guid>
      <dc:creator>echojacques</dc:creator>
      <dc:date>2014-05-16T19:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to "speed up" this search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-quot-speed-up-quot-this-search/m-p/167994#M47891</link>
      <description>&lt;P&gt;rmdfrb,&lt;BR /&gt;
Thanks, I will try to use an accelerated search using your example.  I have tried to configure these before, but never got them to work, but I will try again since this looks like the best way to do this.&lt;/P&gt;</description>
      <pubDate>Fri, 16 May 2014 19:34:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-quot-speed-up-quot-this-search/m-p/167994#M47891</guid>
      <dc:creator>echojacques</dc:creator>
      <dc:date>2014-05-16T19:34:57Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to "speed up" this search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-quot-speed-up-quot-this-search/m-p/167995#M47892</link>
      <description>&lt;P&gt;okay, back to field one...what happens if you search for :&lt;/P&gt;

&lt;P&gt;(sourcetype="firewall" OR sourcetype="ips") (dest_port="21" OR dest_port="22" OR dest_port="3389") (action="blocked" OR action="denied") NOT dest_ip="10.0.0.0/8"&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:38:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-quot-speed-up-quot-this-search/m-p/167995#M47892</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2020-09-28T16:38:49Z</dc:date>
    </item>
  </channel>
</rss>

