<?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: joining ips in splunk index against a csv file with multiple CIDR ranges in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/joining-ips-in-splunk-index-against-a-csv-file-with-multiple/m-p/293118#M88466</link>
    <description>&lt;P&gt;How would I join ip_address field in index=logs before i do these two lookups? also how to use the cidr function?&lt;/P&gt;</description>
    <pubDate>Wed, 22 Nov 2017 15:42:05 GMT</pubDate>
    <dc:creator>spark2310</dc:creator>
    <dc:date>2017-11-22T15:42:05Z</dc:date>
    <item>
      <title>joining ips in splunk index against a csv file with multiple CIDR ranges</title>
      <link>https://community.splunk.com/t5/Splunk-Search/joining-ips-in-splunk-index-against-a-csv-file-with-multiple/m-p/293116#M88464</link>
      <description>&lt;P&gt;I have an index=logs that has an ip_address field like 5.34.244.100&lt;BR /&gt;
I want to look up these all ip_address filed against a csv file that has ips ranges and multiple CIDRs in more than one column. (I've added csv sample at the end)&lt;/P&gt;

&lt;P&gt;How would you write a query to match ip_address field in index=logs against csv file when there is at least one match on range1, or range2 columns? I understand that cidr match, lookup and join functions may be required here but appreciate if someone can show how to write the query?&lt;/P&gt;

&lt;P&gt;cidrs.csv:&lt;BR /&gt;
start   end host    site    range1  range2&lt;BR /&gt;&lt;BR /&gt;
5.34.240.0  5.34.244.255    webexxpurts.com &lt;A href="http://webexxpurts.com/" target="_blank"&gt;http://webexxpurts.com/&lt;/A&gt; 5.34.240.0/22   5.34.244.0/24&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:52:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/joining-ips-in-splunk-index-against-a-csv-file-with-multiple/m-p/293116#M88464</guid>
      <dc:creator>spark2310</dc:creator>
      <dc:date>2020-09-29T16:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: joining ips in splunk index against a csv file with multiple CIDR ranges</title>
      <link>https://community.splunk.com/t5/Splunk-Search/joining-ips-in-splunk-index-against-a-csv-file-with-multiple/m-p/293117#M88465</link>
      <description>&lt;P&gt;You would have to do multiple lookups to accomplish this.  The first would be against range1 &lt;CODE&gt;| lookup cidrs.csv range1 AS ip_address&lt;/CODE&gt; then another to lookup for range2 &lt;CODE&gt;| lookup cidrs.csv range2 AS ip_address&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Doing successive lookups may end up overwriting previously looked up fields, though, so you should look into the OUTPUT and OUTPUTNEW options and choose the one that best helps you solve your problem.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;When using the lookup command, if an OUTPUT or OUTPUTNEW clause is not specified, all of the fields in the lookup table that are not the match field are used as output fields. If the OUTPUT clause is specified, the output lookup fields overwrite existing fields. If the OUTPUTNEW clause is specified, the lookup is not performed for events in which the output fields already exist.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Nov 2017 15:20:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/joining-ips-in-splunk-index-against-a-csv-file-with-multiple/m-p/293117#M88465</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2017-11-22T15:20:13Z</dc:date>
    </item>
    <item>
      <title>Re: joining ips in splunk index against a csv file with multiple CIDR ranges</title>
      <link>https://community.splunk.com/t5/Splunk-Search/joining-ips-in-splunk-index-against-a-csv-file-with-multiple/m-p/293118#M88466</link>
      <description>&lt;P&gt;How would I join ip_address field in index=logs before i do these two lookups? also how to use the cidr function?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2017 15:42:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/joining-ips-in-splunk-index-against-a-csv-file-with-multiple/m-p/293118#M88466</guid>
      <dc:creator>spark2310</dc:creator>
      <dc:date>2017-11-22T15:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: joining ips in splunk index against a csv file with multiple CIDR ranges</title>
      <link>https://community.splunk.com/t5/Splunk-Search/joining-ips-in-splunk-index-against-a-csv-file-with-multiple/m-p/293119#M88467</link>
      <description>&lt;P&gt;I'm not sure what you mean when you say 'join ip _address filed in index=logs'.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2017 15:45:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/joining-ips-in-splunk-index-against-a-csv-file-with-multiple/m-p/293119#M88467</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2017-11-22T15:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: joining ips in splunk index against a csv file with multiple CIDR ranges</title>
      <link>https://community.splunk.com/t5/Splunk-Search/joining-ips-in-splunk-index-against-a-csv-file-with-multiple/m-p/293120#M88468</link>
      <description>&lt;P&gt;This is what I ended up with from what you described (without getting into outputnew)&lt;BR /&gt;
"index=log | lookup cidrs.csv range1 AS ip_address | lookup cidrs.csv range2 AS ip_address"&lt;BR /&gt;
where can cidr function be used in ip_address field index=log to match in lookup? &lt;BR /&gt;
Is join also needed or just csv lookup? &lt;BR /&gt;
how would you write full query based on the sample csv ? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:52:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/joining-ips-in-splunk-index-against-a-csv-file-with-multiple/m-p/293120#M88468</guid>
      <dc:creator>spark2310</dc:creator>
      <dc:date>2020-09-29T16:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: joining ips in splunk index against a csv file with multiple CIDR ranges</title>
      <link>https://community.splunk.com/t5/Splunk-Search/joining-ips-in-splunk-index-against-a-csv-file-with-multiple/m-p/293121#M88469</link>
      <description>&lt;P&gt;CIDR matching is defined in &lt;CODE&gt;transforms.conf&lt;/CODE&gt; per lookup.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Admin/Transformsconf"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Admin/Transformsconf&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;match_type = &amp;lt;string&amp;gt;
* A comma and space-delimited list of &amp;lt;match_type&amp;gt;(&amp;lt;field_name&amp;gt;)
   specification to allow for non-exact matching
* The available match_type values are WILDCARD, CIDR, and EXACT.  EXACT is
   the default and does not need to be specified.  Only fields that should
   use WILDCARD or CIDR matching should be specified in this list
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In your case you probably want something like this in your transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[cidrs]
filename = cidrs.csv
match_type = CIDR(range1), CIDR(range2)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Nov 2017 18:38:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/joining-ips-in-splunk-index-against-a-csv-file-with-multiple/m-p/293121#M88469</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2017-11-22T18:38:57Z</dc:date>
    </item>
  </channel>
</rss>

