<?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: A more efficient query ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/A-more-efficient-query/m-p/52636#M12801</link>
    <description>&lt;P&gt;It will not just shorten it, most of all it will make it faster, because the &lt;CODE&gt;search&lt;/CODE&gt; command will not have to retrieve as many items from disk just to send them off to &lt;CODE&gt;where&lt;/CODE&gt; which will just discard lots of them.&lt;/P&gt;

&lt;P&gt;If you have that many CIDR blocks, I'd advise you to use a lookup table (they can do CIDR matches as well) - not that I think it'll make any difference performance-wise, but the query will obviously not become two miles long &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Dec 2012 22:51:07 GMT</pubDate>
    <dc:creator>Ayn</dc:creator>
    <dc:date>2012-12-03T22:51:07Z</dc:date>
    <item>
      <title>A more efficient query ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/A-more-efficient-query/m-p/52633#M12798</link>
      <description>&lt;P&gt;One of our users has beought forth the following question:&lt;/P&gt;

&lt;P&gt;I would like to be able to determine if IP Addresses from China are attempting to hit one or more of our servers.  I have a list IP ranges for China in CIDR Notation, to the tune of 3400+, ranges.  I have figured out how to make a query using the cidrmatch function, but I am afraid that a query of this nature may cause a severe negative impact on the performance of our Splunk environment.&lt;/P&gt;

&lt;P&gt;The basics of the query that I have put together are:&lt;/P&gt;

&lt;P&gt;host=myhost AND error_code-12345 | where (cidrmatch("cidrblk1/24", src) OR cidrmatch("cidrblk2/17", src) OR cidrmatch("cidrblk3/19", src) OR...)&lt;/P&gt;

&lt;P&gt;Is there a better, more efficient way, "SAFER" way to handle this?&lt;/P&gt;

&lt;P&gt;Is there a better way to handle this?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Dec 2012 21:05:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/A-more-efficient-query/m-p/52633#M12798</guid>
      <dc:creator>ddebevec</dc:creator>
      <dc:date>2012-12-03T21:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: A more efficient query ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/A-more-efficient-query/m-p/52634#M12799</link>
      <description>&lt;P&gt;The &lt;CODE&gt;search&lt;/CODE&gt; command can handle CIDR blocks directly, so there's no need to use a separate &lt;CODE&gt;where&lt;/CODE&gt; clause there. That will also speed things up.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=myhost AND error_code=12345 AND (src=cidrblk1/24 OR src=cidrblk2/17 OR ...)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note also that the MAXMIND app is pretty good for when you want to perform geolocation searches like this. You'll find it here: &lt;A href="http://splunk-base.splunk.com/apps/22282/geo-location-lookup-script-powered-by-maxmind"&gt;http://splunk-base.splunk.com/apps/22282/geo-location-lookup-script-powered-by-maxmind&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Dec 2012 21:24:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/A-more-efficient-query/m-p/52634#M12799</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2012-12-03T21:24:07Z</dc:date>
    </item>
    <item>
      <title>Re: A more efficient query ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/A-more-efficient-query/m-p/52635#M12800</link>
      <description>&lt;P&gt;Ayn,  Thanks for the reply.  I am actually the per who asked this question of ddebevec.  That will shortent eh actual text of the query.  I am looking to see if this is the mst efficient way to do this, or is there another means? The query would still have 3400+ items.  Would something like the following severly impact the performance of the server?&lt;/P&gt;

&lt;P&gt;host=myhost AND error_code=12345 AND (src=cidrblk1/24 OR src=cidrblk2/17 OR ... src=cidrblk1142/24 OP ... OR src=cidrblk2237/15 OR ... OR src=cidrblk3447/23)&lt;/P&gt;

&lt;P&gt;Is ther ea way to use a table or some other construct?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Dec 2012 22:42:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/A-more-efficient-query/m-p/52635#M12800</guid>
      <dc:creator>cmbarber</dc:creator>
      <dc:date>2012-12-03T22:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: A more efficient query ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/A-more-efficient-query/m-p/52636#M12801</link>
      <description>&lt;P&gt;It will not just shorten it, most of all it will make it faster, because the &lt;CODE&gt;search&lt;/CODE&gt; command will not have to retrieve as many items from disk just to send them off to &lt;CODE&gt;where&lt;/CODE&gt; which will just discard lots of them.&lt;/P&gt;

&lt;P&gt;If you have that many CIDR blocks, I'd advise you to use a lookup table (they can do CIDR matches as well) - not that I think it'll make any difference performance-wise, but the query will obviously not become two miles long &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Dec 2012 22:51:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/A-more-efficient-query/m-p/52636#M12801</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2012-12-03T22:51:07Z</dc:date>
    </item>
  </channel>
</rss>

