<?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: Modify search string from input field to search IP addr db in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Modify-search-string-from-input-field-to-search-IP-addr-db/m-p/446212#M177036</link>
    <description>&lt;P&gt;You need to do something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults 
| eval ip = 10.10.10.123 (This would obviously be the $address$ from the form)
| rex field=ip "(?&amp;lt;address&amp;gt;\d+.\d+.\d+.)\d+" 
| lookup IPAM-Allnetworks.csv address OUTPUT
| table address cidr location VLAN (i.e. interesting fields from CSV)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This code assumes that your CSV has a column called "address" in it&lt;/P&gt;</description>
    <pubDate>Wed, 06 Feb 2019 00:51:51 GMT</pubDate>
    <dc:creator>chrisyounger</dc:creator>
    <dc:date>2019-02-06T00:51:51Z</dc:date>
    <item>
      <title>Modify search string from input field to search IP addr db</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Modify-search-string-from-input-field-to-search-IP-addr-db/m-p/446211#M177035</link>
      <description>&lt;P&gt;I'm trying to create a dashboard that lets a user input an IP address and then search through the IP address database to search for the subnet and location.&lt;/P&gt;

&lt;P&gt;e.g. if someone enters 10.10.10.123, it would basically do a search through a csv of "10.10.10."&lt;/P&gt;

&lt;P&gt;So I've tried this for example (among a 1000 other things)&lt;BR /&gt;
| inputlookup IPAM-Allnetworks.csv &lt;BR /&gt;
| search address=10.10.10.123                     (This would obviously be the $address$ from the form)&lt;BR /&gt;
| rex field=address "(?\d+.\d+.\d+.)\d+" &lt;BR /&gt;
|  where address = src_subnet&lt;BR /&gt;
| table address cidr location VLAN             (i.e. interesting fields from CSV)&lt;/P&gt;

&lt;P&gt;Yes, this will only work for /24 subnets, but will cover most use cases. &lt;/P&gt;

&lt;P&gt;The problem I see is that I need to extract the fields before actually searching. I can see why my search doesn't work but not sure how to fix it. &lt;/P&gt;</description>
      <pubDate>Wed, 06 Feb 2019 00:25:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Modify-search-string-from-input-field-to-search-IP-addr-db/m-p/446211#M177035</guid>
      <dc:creator>horst_poehlmann</dc:creator>
      <dc:date>2019-02-06T00:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: Modify search string from input field to search IP addr db</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Modify-search-string-from-input-field-to-search-IP-addr-db/m-p/446212#M177036</link>
      <description>&lt;P&gt;You need to do something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults 
| eval ip = 10.10.10.123 (This would obviously be the $address$ from the form)
| rex field=ip "(?&amp;lt;address&amp;gt;\d+.\d+.\d+.)\d+" 
| lookup IPAM-Allnetworks.csv address OUTPUT
| table address cidr location VLAN (i.e. interesting fields from CSV)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This code assumes that your CSV has a column called "address" in it&lt;/P&gt;</description>
      <pubDate>Wed, 06 Feb 2019 00:51:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Modify-search-string-from-input-field-to-search-IP-addr-db/m-p/446212#M177036</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2019-02-06T00:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: Modify search string from input field to search IP addr db</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Modify-search-string-from-input-field-to-search-IP-addr-db/m-p/446213#M177037</link>
      <description>&lt;P&gt;Thanks. I tried something similar, but the eval command gives me: &lt;/P&gt;

&lt;P&gt;Error in 'eval' command: The number 10.10.10.123 is invalid. &lt;/P&gt;</description>
      <pubDate>Wed, 06 Feb 2019 00:59:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Modify-search-string-from-input-field-to-search-IP-addr-db/m-p/446213#M177037</guid>
      <dc:creator>horst_poehlmann</dc:creator>
      <dc:date>2019-02-06T00:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: Modify search string from input field to search IP addr db</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Modify-search-string-from-input-field-to-search-IP-addr-db/m-p/446214#M177038</link>
      <description>&lt;P&gt;Quotes around it worked. I just need to work out how to add a "*" wildcard to the end of the search so that it searches:&lt;/P&gt;

&lt;P&gt;address=10.10.10.*&lt;/P&gt;</description>
      <pubDate>Wed, 06 Feb 2019 01:09:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Modify-search-string-from-input-field-to-search-IP-addr-db/m-p/446214#M177038</guid>
      <dc:creator>horst_poehlmann</dc:creator>
      <dc:date>2019-02-06T01:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: Modify search string from input field to search IP addr db</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Modify-search-string-from-input-field-to-search-IP-addr-db/m-p/446215#M177039</link>
      <description>&lt;P&gt;You need to show a couple of sample rows from your lookup so we can help you better.  I assumed the lookup had an "address" column with just the first three octets in the column&lt;/P&gt;</description>
      <pubDate>Wed, 06 Feb 2019 01:18:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Modify-search-string-from-input-field-to-search-IP-addr-db/m-p/446215#M177039</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2019-02-06T01:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: Modify search string from input field to search IP addr db</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Modify-search-string-from-input-field-to-search-IP-addr-db/m-p/446216#M177040</link>
      <description>&lt;P&gt;Sorry. The lines look something like this:&lt;/P&gt;

&lt;P&gt;network,10.10.10.0,255.255.255.0,10.10.10.0/255.255.255.0,,,,,,Core/Server Room,,,,,FALSE,,,,,,,,,FALSE,FALSE,,,,,,,FALSE,LAN Addressing,,,,95,85,0,10,,,,,,,,,,,,,Site ABC,,OVERRIDE,432,,Voice Vlan222,*,OVERRIDE&lt;/P&gt;

&lt;P&gt;I'm searching on field 2 (address).&lt;BR /&gt;
Thx&lt;/P&gt;</description>
      <pubDate>Thu, 07 Feb 2019 02:22:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Modify-search-string-from-input-field-to-search-IP-addr-db/m-p/446216#M177040</guid>
      <dc:creator>horst_poehlmann</dc:creator>
      <dc:date>2019-02-07T02:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: Modify search string from input field to search IP addr db</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Modify-search-string-from-input-field-to-search-IP-addr-db/m-p/446217#M177041</link>
      <description>&lt;P&gt;The lines of the lookup table look something like this:&lt;/P&gt;

&lt;P&gt;network,10.10.10.0,255.255.255.0,10.10.10.0/255.255.255.0,,,,,,Core/Server Room,,,,,FALSE,,,,,,,,,FALSE,FALSE,,,,,,,FALSE,LAN Addressing,,,,95,85,0,10,,,,,,,,,,,,,Site ABC,,OVERRIDE,432,,Voice Vlan222,*,OVERRIDE&lt;/P&gt;

&lt;P&gt;I'm searching on field 2 (which is the "address" field).&lt;/P&gt;

&lt;P&gt;I sort of got it working by adding a "0" to the extracted field, e.g.&lt;/P&gt;

&lt;P&gt;|makeresults &lt;BR /&gt;
 | eval ip = "10.10.10.123"&lt;BR /&gt;
 | rex field=ip "(?\d+.\d+.\d+.)\d+" &lt;BR /&gt;
 | eval address=address1."0"&lt;BR /&gt;
 | lookup IPAM-Allnetworks address OUTPUT &lt;BR /&gt;
 | table &lt;/P&gt;

&lt;P&gt;but is there a way to do a wildcard search instead? (i.e. 10.10.10.*)&lt;/P&gt;

&lt;P&gt;Thx&lt;/P&gt;

&lt;P&gt;PS: Not sure what happened to the previous comments.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Feb 2019 23:08:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Modify-search-string-from-input-field-to-search-IP-addr-db/m-p/446217#M177041</guid>
      <dc:creator>horst_poehlmann</dc:creator>
      <dc:date>2019-02-07T23:08:06Z</dc:date>
    </item>
  </channel>
</rss>

