<?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: Nested inputlookup with where clause in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Nested-inputlookup-with-where-clause/m-p/670393#M229818</link>
    <description>&lt;P&gt;Thank you very much, that explains it!&lt;BR /&gt;I was able to complete my little proof of concept, this is my complete search:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;sourcetype=nftemp
| top 100 SRC
| eval ip_address = SRC
| eval ip_dot_decimal_split=split(ip_address,".")
| eval first=mvindex(ip_dot_decimal_split,0),second=mvindex(ip_dot_decimal_split,1),third=mvindex(ip_dot_decimal_split,2),fourth=mvindex(ip_dot_decimal_split,3)
| fields - ip_dot_decimal_split
| eval first=first*pow(256,3),second=second*pow(256,2),third=third*256
| eval ip_address_integer=first+second+third+fourth
| map search=" | inputlookup geobeta 
| where endIPNum &amp;gt;= $ip_address_integer$ AND startIPNum &amp;lt;= $ip_address_integer$
| eval ip=$ip_address$
| eval mapcount=$count$
| sort mapcount
| table mapcount,ip,country_iso_code,latitude,longitude,ASName,ASNumber" maxsearches=20000&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The sourcetype is a random generated nftables log with a few IPs in it, then convert the ip's to decimal&lt;BR /&gt;and do the search against the geobeta lookup. The source of the geobeta lookup contains also only a few records, not sure how it will perform when the geobeta lookup will have millions of records in it, lets see ... geobeta comes from maxmind by the way.&lt;/P&gt;</description>
    <pubDate>Thu, 30 Nov 2023 20:00:27 GMT</pubDate>
    <dc:creator>MattKr</dc:creator>
    <dc:date>2023-11-30T20:00:27Z</dc:date>
    <item>
      <title>Nested inputlookup with where clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Nested-inputlookup-with-where-clause/m-p/670338#M229813</link>
      <description>&lt;P&gt;I am trying to build my own kvstore geo data, so far i can run&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup geobeta
| where endIPNum &amp;gt;= 1317914622 and startIPNum &amp;lt;= 1317914622
| table latitude,longitude
&lt;/LI-CODE&gt;&lt;P&gt;That returns:&lt;/P&gt;&lt;P&gt;latitude,longitude&lt;BR /&gt;"51.5128","-0.0638"&lt;/P&gt;&lt;P&gt;But how do i combine this with a search?&lt;/P&gt;&lt;P&gt;I was trying this but it doesn't work:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
eval ip_address_integer=1317914622
[ | inputlookup geobeta
| where endIPNum &amp;gt;= ip_address_integer and startIPNum &amp;lt;= ip_address_integer ]
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks for hints&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2023 15:22:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Nested-inputlookup-with-where-clause/m-p/670338#M229813</guid>
      <dc:creator>MattKr</dc:creator>
      <dc:date>2023-11-30T15:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: Nested inputlookup with where clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Nested-inputlookup-with-where-clause/m-p/670341#M229814</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/257920"&gt;@MattKr&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;what have you to do? use the lookup's geo coordinates to filter results or what else?&lt;/P&gt;&lt;P&gt;if you want to use the values in the lookup for a subsearch, you have to use the rules of a subsearch, so the fields in the subsearch must have the same field names.&lt;/P&gt;&lt;P&gt;Then you can use thewhere clause inside the inputlookup command.&lt;/P&gt;&lt;P&gt;Put attention that the AND logical operator must be in uppercase to be recognized:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup geobeta WHERE endIPNum&amp;gt;=1317914622 AND startIPNum&amp;lt;=1317914622
| table latitude longitude&lt;/LI-CODE&gt;&lt;P&gt;Then, how are your IP address written?&lt;/P&gt;&lt;P&gt;At least, using lookups, you can also have CIDR match type as described at&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/latest/Knowledge/Usefieldlookupstoaddinformationtoyourevents" target="_blank"&gt;https://docs.splunk.com/Documentation/SplunkCloud/latest/Knowledge/Usefieldlookupstoaddinformationtoyourevents&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2023 15:40:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Nested-inputlookup-with-where-clause/m-p/670341#M229814</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-11-30T15:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: Nested inputlookup with where clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Nested-inputlookup-with-where-clause/m-p/670353#M229815</link>
      <description>&lt;P&gt;Subsearches are executed before the main search so your ip_address_integer has no value when the inputlookup is executed.&lt;/P&gt;&lt;P&gt;You could try using the map command (although this has its limitations and perhaps should be avoided where possible).&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval ip_address_integer = 1317914622
| map search="| inputlookup geobeta
| where endIPNum &amp;gt;= $ip_address_integer$ AND startIPNum &amp;lt;= $ip_address_integer$
| table latitude,longitude"&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 30 Nov 2023 16:24:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Nested-inputlookup-with-where-clause/m-p/670353#M229815</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-11-30T16:24:20Z</dc:date>
    </item>
    <item>
      <title>Re: Nested inputlookup with where clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Nested-inputlookup-with-where-clause/m-p/670392#M229817</link>
      <description>&lt;P&gt;Hi Giuseppe,&lt;BR /&gt;thanks for your response.&lt;BR /&gt;I would like to expand the IPv4 addresses and are looking for lat/lon, country and AS informations.&lt;BR /&gt;As i do already have the maxmind database in my own mySQL i thought to convert the data into a kvstore&lt;BR /&gt;and get my data from there.&lt;/P&gt;&lt;P&gt;None of the Apps on the market had ready suited for me unless i missed one, so i thought to do this by my own .. its just a hobby ...&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Matthias&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2023 19:59:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Nested-inputlookup-with-where-clause/m-p/670392#M229817</guid>
      <dc:creator>MattKr</dc:creator>
      <dc:date>2023-11-30T19:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: Nested inputlookup with where clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Nested-inputlookup-with-where-clause/m-p/670393#M229818</link>
      <description>&lt;P&gt;Thank you very much, that explains it!&lt;BR /&gt;I was able to complete my little proof of concept, this is my complete search:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;sourcetype=nftemp
| top 100 SRC
| eval ip_address = SRC
| eval ip_dot_decimal_split=split(ip_address,".")
| eval first=mvindex(ip_dot_decimal_split,0),second=mvindex(ip_dot_decimal_split,1),third=mvindex(ip_dot_decimal_split,2),fourth=mvindex(ip_dot_decimal_split,3)
| fields - ip_dot_decimal_split
| eval first=first*pow(256,3),second=second*pow(256,2),third=third*256
| eval ip_address_integer=first+second+third+fourth
| map search=" | inputlookup geobeta 
| where endIPNum &amp;gt;= $ip_address_integer$ AND startIPNum &amp;lt;= $ip_address_integer$
| eval ip=$ip_address$
| eval mapcount=$count$
| sort mapcount
| table mapcount,ip,country_iso_code,latitude,longitude,ASName,ASNumber" maxsearches=20000&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The sourcetype is a random generated nftables log with a few IPs in it, then convert the ip's to decimal&lt;BR /&gt;and do the search against the geobeta lookup. The source of the geobeta lookup contains also only a few records, not sure how it will perform when the geobeta lookup will have millions of records in it, lets see ... geobeta comes from maxmind by the way.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2023 20:00:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Nested-inputlookup-with-where-clause/m-p/670393#M229818</guid>
      <dc:creator>MattKr</dc:creator>
      <dc:date>2023-11-30T20:00:27Z</dc:date>
    </item>
  </channel>
</rss>

