<?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: How to perform lookup from index search with dbxquery? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-perform-lookup-from-index-search-with-dbxquery/m-p/651044#M225095</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;Sorry I wasn't clear,&lt;BR /&gt;DBXquery has field "SubnetID-IP" , not ip_address&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;SPAN&gt;Company&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;SPAN&gt;Location&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;SPAN&gt;SubnetID-IP&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="69px"&gt;&lt;SPAN&gt;Comp-A&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="69px"&gt;&lt;SPAN&gt;Loc- A&amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="69px"&gt;&lt;SPAN&gt;&amp;nbsp;[{"subnet_id":"101","ip_address":"192.168.1.1"},{"subnet_id":"121","ip_address":"192.168.1.21"},{"subnet_id":"131","ip_address":"192.168.1.31"}]&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="69px"&gt;&lt;SPAN&gt;Comp-B&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="69px"&gt;&lt;SPAN&gt;Loc-B&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="69px"&gt;&lt;SPAN&gt;&amp;nbsp;[{"subnet_id":"102","ip_address":"192.168.1.2"},{"subnet_id":"122","ip_address":"192.168.1.22"},{"subnet_id":"123","ip_address":"192.168.1.23"}]&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="47px"&gt;&lt;SPAN&gt;Comp-E&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="47px"&gt;&lt;SPAN&gt;Loc-E&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="47px"&gt;&lt;SPAN&gt;[{"subnet_id":"105","ip_address":"192.168.1.5"},{"subnet_id":"152","ip_address":"192.168.1.52"}]&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;SubnetID-IP needs to be parsed using&lt;BR /&gt;| spath input=&lt;SPAN&gt;SubnetID-IP path={}&lt;BR /&gt;&lt;/SPAN&gt;| mvexpand {}&lt;BR /&gt;| spath input={}&lt;BR /&gt;| table Company, Location, ip_address&lt;BR /&gt;The output after parsing is below:&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;SPAN&gt;company&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;SPAN&gt;location&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;SPAN&gt;ip_address&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="69px"&gt;&lt;SPAN&gt;Comp-A&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="69px"&gt;&lt;SPAN&gt;Loc- A&amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="69px"&gt;&lt;SPAN&gt;192.168.1.1&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="69px"&gt;&lt;SPAN&gt;Comp-B&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="69px"&gt;&lt;SPAN&gt;Loc-B&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="69px"&gt;&lt;SPAN&gt;192.168.1.2&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="47px"&gt;&lt;SPAN&gt;Comp-E&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="47px"&gt;&lt;SPAN&gt;Loc-E&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="47px"&gt;192.168.1.5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;STRONG&gt;How do I combine dbquery and spath and index?&amp;nbsp;&lt;BR /&gt;Thanks&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Jul 2023 18:48:07 GMT</pubDate>
    <dc:creator>LearningGuy</dc:creator>
    <dc:date>2023-07-18T18:48:07Z</dc:date>
    <item>
      <title>How to perform lookup from index search with dbxquery?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-perform-lookup-from-index-search-with-dbxquery/m-p/650654#M224958</link>
      <description>&lt;P&gt;How to perform lookup from index search with dbxquery?&lt;BR /&gt;&lt;BR /&gt;| index=vulnerability_index&lt;BR /&gt;| table ip_address, vulnerability, score&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="155.183px" height="25px"&gt;ip_address&lt;/TD&gt;&lt;TD width="155.2px" height="25px"&gt;vulnerability&lt;/TD&gt;&lt;TD width="155.167px" height="25px"&gt;score&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="155.183px" height="25px"&gt;192.168.1.1&lt;/TD&gt;&lt;TD width="155.2px" height="25px"&gt;SQL Injection&lt;/TD&gt;&lt;TD width="155.167px" height="25px"&gt;9&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="155.183px" height="25px"&gt;192.168.1.1&lt;/TD&gt;&lt;TD width="155.2px" height="25px"&gt;OpenSSL&lt;/TD&gt;&lt;TD width="155.167px" height="25px"&gt;7&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="155.183px" height="25px"&gt;192.168.1.2&lt;/TD&gt;&lt;TD width="155.2px" height="25px"&gt;Cross Site-Scripting&lt;/TD&gt;&lt;TD width="155.167px" height="25px"&gt;8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;192.168.1.2&lt;/TD&gt;&lt;TD&gt;DNS&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;| dbxquery query="select * from tableCompany"&lt;/P&gt;&lt;TABLE border="1" width="467.00000000000006px"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="155.66666666666669px"&gt;ip_address&lt;/TD&gt;&lt;TD width="155.66666666666669px"&gt;company&lt;/TD&gt;&lt;TD width="155.66666666666669px"&gt;location&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="155.66666666666669px"&gt;192.168.1.1&lt;/TD&gt;&lt;TD width="155.66666666666669px"&gt;Comp-A&lt;/TD&gt;&lt;TD width="155.66666666666669px"&gt;Loc-A&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="155.66666666666669px"&gt;192.168.1.2&lt;/TD&gt;&lt;TD width="155.66666666666669px"&gt;Comp-B&lt;/TD&gt;&lt;TD width="155.66666666666669px"&gt;Loc-B&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="155.66666666666669px"&gt;192.168.1.5&lt;/TD&gt;&lt;TD width="155.66666666666669px"&gt;Comp-E&lt;/TD&gt;&lt;TD width="155.66666666666669px"&gt;Loc-E&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;After lookup IP in dbxquery:&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="20%" height="25px"&gt;ip_address&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;company&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;location&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;vulnerability&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;Score&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%" height="47px"&gt;192.168.1.1&lt;/TD&gt;&lt;TD width="20%" height="47px"&gt;Comp-A&lt;/TD&gt;&lt;TD width="20%" height="47px"&gt;Loc-A&lt;/TD&gt;&lt;TD width="20%" height="47px"&gt;SQL Injection&lt;/TD&gt;&lt;TD width="20%" height="47px"&gt;9&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%" height="25px"&gt;192.168.1.1&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;Comp-A&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;Loc-A&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;OpenSSL&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;7&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%" height="25px"&gt;192.168.1.2&lt;/TD&gt;&lt;TD width="20%"&gt;Comp-B&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;Loc-B&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;Cross Site-Scripting&lt;/TD&gt;&lt;TD width="20%" height="25px"&gt;8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%"&gt;192.168.1.2&lt;/TD&gt;&lt;TD width="20%"&gt;Comp-B&lt;/TD&gt;&lt;TD width="20%"&gt;Loc-B&lt;/TD&gt;&lt;TD width="20%"&gt;DNS&lt;/TD&gt;&lt;TD width="20%"&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;Thank you so much&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jul 2023 03:12:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-perform-lookup-from-index-search-with-dbxquery/m-p/650654#M224958</guid>
      <dc:creator>LearningGuy</dc:creator>
      <dc:date>2023-07-15T03:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform lookup from index search with dbxquery?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-perform-lookup-from-index-search-with-dbxquery/m-p/650662#M224963</link>
      <description>&lt;P&gt;dbxquery cannot be used as lookup directly. &amp;nbsp;You can do something like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| index=vulnerability_index
| table ip_address, vulnerability, score
| append
    [| dbxquery query="select * from tableCompany" ```select ip_address,company,location from tableCompany```]
| stats values(*) as * by ip_address&lt;/LI-CODE&gt;&lt;P&gt;But lookup is much more efficient. &amp;nbsp;You should consider set up an external lookup script to lookup from your database. &amp;nbsp;That way, you can use lookup as intended.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| index=vulnerability_index
| table ip_address, vulnerability, score
| lookup lookupCompany ip_address ``` output company,location ```&lt;/LI-CODE&gt;&lt;P&gt;where lookupCompany is the lookup you set up to perform the SQL query against that database.&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jul 2023 06:05:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-perform-lookup-from-index-search-with-dbxquery/m-p/650662#M224963</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-07-15T06:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform lookup from index search with dbxquery?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-perform-lookup-from-index-search-with-dbxquery/m-p/651029#M225091</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;BR /&gt;I ran your query and it seems like it just appended the row &lt;STRONG&gt;without matching the IP.&lt;/STRONG&gt;&amp;nbsp;&lt;BR /&gt;This question is related to the other post that you helped me "split pattern into multiple rows"&lt;BR /&gt;&lt;A href="https://community.splunk.com/t5/Splunk-Search/Split-pattern-into-multiple-rows/m-p/650660" target="_blank"&gt;https://community.splunk.com/t5/Splunk-Search/Split-pattern-into-multiple-rows/m-p/650660&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;My goal is to replace the &lt;STRONG&gt;table.csv&lt;/STRONG&gt;, which was obtained from&lt;BR /&gt;| dbxquery&amp;nbsp;connection=visibility query="select Company, Location, SubnetID-IP from tableCompany"&lt;BR /&gt;then parsed the IP and SubnetID using spath, and performed mvexpand to split into single event&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Instead of running dbxquery and put the data into table.csv to perform a IP lookup from index,&lt;BR /&gt;is it possible to run a single query that combine index search and dbxquery to match/lookup an IP address?&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2023 16:00:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-perform-lookup-from-index-search-with-dbxquery/m-p/651029#M225091</guid>
      <dc:creator>LearningGuy</dc:creator>
      <dc:date>2023-07-18T16:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform lookup from index search with dbxquery?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-perform-lookup-from-index-search-with-dbxquery/m-p/651035#M225092</link>
      <description>&lt;P&gt;First, there was a syntax error copied from the original post. &amp;nbsp;There should not be a leading pipe for index search:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=vulnerability_index
| table ip_address, vulnerability, score
| append
    [| dbxquery query="select * from tableCompany" ```select ip_address,company,location from tableCompany```]
| stats values(*) as * by ip_address&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second, can you confirm that both &lt;FONT face="courier new,courier"&gt;index=vulnerability_index&lt;/FONT&gt;&amp;nbsp;and &lt;FONT face="courier new,courier"&gt;|&amp;nbsp;dbxquery query="select * from tableCompany"&lt;/FONT&gt; return a field named &lt;FONT face="courier new,courier"&gt;ip_address&lt;/FONT&gt;, and that some of their values match? &amp;nbsp;In fact, if there is no matching values, no output should exist; if field name ip_address only exists in one search, output should contain only entries from that search. &amp;nbsp;So your described output is very puzzling.&lt;/P&gt;&lt;P&gt;Yes, the above suggested search is intended to run a query directly from Splunk and perform a match. &amp;nbsp;When I suggested running an external query command as external lookup, I mean&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Knowledge/DefineanexternallookupinSplunkWeb#Create_an_external_lookup" target="_blank" rel="noopener"&gt;Create an external lookup&lt;/A&gt;, not to run a query and create a static (CSV or KV store) lookup. (On such external lookup is shipped with Splunk Enterprise, &lt;A href="http://your-splunk/en-US/manager/search/data/transforms/lookups/dnslookup?action=edit&amp;amp;ns=system&amp;amp;f_ns=search&amp;amp;f_search=dns&amp;amp;f_count=25&amp;amp;uri=%2FservicesNS%2Fnobody%2Fsystem%2Fdata%2Ftransforms%2Flookups%2Fdnslookup" target="_blank" rel="noopener"&gt;dnslookup&lt;/A&gt;.)&amp;nbsp;The effect is still the same: a query is performed at the time of the search. &amp;nbsp;But you don't have to perform a stats to make association.&lt;/P&gt;&lt;P&gt;To help you diagnose, I have to emulations, one to emulate the index search and return rows as you posted, the other to emulate | dbxquery and return rows as you posted. &amp;nbsp;The two are combined in the same fashion as the above command:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw = "ip_address	vulnerability	score
192.168.1.1	SQL Injection	9
192.168.1.1	OpenSSL	7
192.168.1.2	Cross Site-Scripting	8
192.168.1.2	DNS	5"

| multikv forceheader=1
``` the above emulates index=vulnerability_index ```
| table ip_address, vulnerability, score
| append
    [| makeresults
    | eval _raw = "ip_address	company	location
192.168.1.1	Comp-A	Loc-A
192.168.1.2	Comp-B	Loc-B
192.168.1.5	Comp-E	Loc-E"
    | multikv forceheader=1
    | fields - _* linecount
    ``` the above emulates | dbxquery query="select * from tableCompany" ```
    ]
| stats values(*) as * by ip_address&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;They give me the output that you desired, as&lt;/P&gt;&lt;TABLE width="423px"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="97.125px"&gt;ip_address&lt;/TD&gt;&lt;TD width="78px"&gt;company&lt;/TD&gt;&lt;TD width="52.875px"&gt;location&lt;/TD&gt;&lt;TD width="40px"&gt;&lt;DIV class=""&gt;score&lt;/DIV&gt;&lt;/TD&gt;&lt;TD width="154.015625px"&gt;&lt;DIV class=""&gt;vulnerability&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="97.125px"&gt;192.168.1.1&lt;/TD&gt;&lt;TD width="78px"&gt;Comp-A&lt;/TD&gt;&lt;TD width="52.875px"&gt;Loc-A&lt;/TD&gt;&lt;TD width="40px"&gt;&lt;DIV class=""&gt;7&lt;/DIV&gt;&lt;DIV class=""&gt;9&lt;/DIV&gt;&lt;/TD&gt;&lt;TD width="154.015625px"&gt;&lt;DIV class=""&gt;OpenSSL&lt;/DIV&gt;&lt;DIV class=""&gt;SQL Injection&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="97.125px"&gt;192.168.1.2&lt;/TD&gt;&lt;TD width="78px"&gt;Comp-B&lt;/TD&gt;&lt;TD width="52.875px"&gt;Loc-B&lt;/TD&gt;&lt;TD width="40px"&gt;&lt;DIV class=""&gt;5&lt;/DIV&gt;&lt;DIV class=""&gt;8&lt;/DIV&gt;&lt;/TD&gt;&lt;TD width="154.015625px"&gt;&lt;DIV class=""&gt;Cross Site-Scripting&lt;/DIV&gt;&lt;DIV class=""&gt;DNS&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="97.125px"&gt;192.168.1.5&lt;/TD&gt;&lt;TD width="78px"&gt;Comp-E&lt;/TD&gt;&lt;TD width="52.875px"&gt;Loc-E&lt;/TD&gt;&lt;TD width="40px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="154.015625px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;You can play with the emulation and compare with real data.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2023 17:01:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-perform-lookup-from-index-search-with-dbxquery/m-p/651035#M225092</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-07-18T17:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform lookup from index search with dbxquery?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-perform-lookup-from-index-search-with-dbxquery/m-p/651044#M225095</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;Sorry I wasn't clear,&lt;BR /&gt;DBXquery has field "SubnetID-IP" , not ip_address&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;SPAN&gt;Company&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;SPAN&gt;Location&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;SPAN&gt;SubnetID-IP&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="69px"&gt;&lt;SPAN&gt;Comp-A&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="69px"&gt;&lt;SPAN&gt;Loc- A&amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="69px"&gt;&lt;SPAN&gt;&amp;nbsp;[{"subnet_id":"101","ip_address":"192.168.1.1"},{"subnet_id":"121","ip_address":"192.168.1.21"},{"subnet_id":"131","ip_address":"192.168.1.31"}]&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="69px"&gt;&lt;SPAN&gt;Comp-B&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="69px"&gt;&lt;SPAN&gt;Loc-B&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="69px"&gt;&lt;SPAN&gt;&amp;nbsp;[{"subnet_id":"102","ip_address":"192.168.1.2"},{"subnet_id":"122","ip_address":"192.168.1.22"},{"subnet_id":"123","ip_address":"192.168.1.23"}]&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="47px"&gt;&lt;SPAN&gt;Comp-E&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="47px"&gt;&lt;SPAN&gt;Loc-E&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="47px"&gt;&lt;SPAN&gt;[{"subnet_id":"105","ip_address":"192.168.1.5"},{"subnet_id":"152","ip_address":"192.168.1.52"}]&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;SubnetID-IP needs to be parsed using&lt;BR /&gt;| spath input=&lt;SPAN&gt;SubnetID-IP path={}&lt;BR /&gt;&lt;/SPAN&gt;| mvexpand {}&lt;BR /&gt;| spath input={}&lt;BR /&gt;| table Company, Location, ip_address&lt;BR /&gt;The output after parsing is below:&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;SPAN&gt;company&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;SPAN&gt;location&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;SPAN&gt;ip_address&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="69px"&gt;&lt;SPAN&gt;Comp-A&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="69px"&gt;&lt;SPAN&gt;Loc- A&amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="69px"&gt;&lt;SPAN&gt;192.168.1.1&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="69px"&gt;&lt;SPAN&gt;Comp-B&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="69px"&gt;&lt;SPAN&gt;Loc-B&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="69px"&gt;&lt;SPAN&gt;192.168.1.2&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="47px"&gt;&lt;SPAN&gt;Comp-E&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="47px"&gt;&lt;SPAN&gt;Loc-E&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="47px"&gt;192.168.1.5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;STRONG&gt;How do I combine dbquery and spath and index?&amp;nbsp;&lt;BR /&gt;Thanks&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2023 18:48:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-perform-lookup-from-index-search-with-dbxquery/m-p/651044#M225095</guid>
      <dc:creator>LearningGuy</dc:creator>
      <dc:date>2023-07-18T18:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform lookup from index search with dbxquery?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-perform-lookup-from-index-search-with-dbxquery/m-p/651054#M225096</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just add JSON handling inside the subsearch.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=vulnerability_index
| table ip_address, vulnerability, score
| append
    [| dbxquery query="select * from tableCompany" ```select ip_address,company,location from tableCompany```
    | spath input="SubnetID-IP" path={}
    | mvexpand {}
    | spath input={} path=ip_address
    | table Company, Location, ip_address ]
| stats values(*) as * by ip_address&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my emulation&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw = "ip_address	vulnerability	score
192.168.1.1	SQL Injection	9
192.168.1.1	OpenSSL	7
192.168.1.2	Cross Site-Scripting	8
192.168.1.2	DNS	5"

| multikv forceheader=1
``` the above emulates index=vulnerability_index ```
| table ip_address, vulnerability, score
| append
    [| makeresults
    | eval _raw = "Company        	Location       	SubnetID-IP
Comp-A	Loc-A 	 [{\"subnet_id\":\"101\",\"ip_address\":\"192.168.1.1\"},{\"subnet_id\":\"121\",\"ip_address\":\"192.168.1.21\"},{\"subnet_id\":\"131\",\"ip_address\":\"192.168.1.31\"}]
Comp-B	Loc-B	 [{\"subnet_id\":\"102\",\"ip_address\":\"192.168.1.2\"},{\"subnet_id\":\"122\",\"ip_address\":\"192.168.1.22\"},{\"subnet_id\":\"123\",\"ip_address\":\"192.168.1.23\"}]
Comp-E	Loc-E	[{\"subnet_id\":\"105\",\"ip_address\":\"192.168.1.5\"},{\"subnet_id\":\"152\",\"ip_address\":\"192.168.1.52\"}]"
    | multikv forceheader=1
    | rename *________ as *, *_______ as *
    | fields - _* linecount
    ``` the above emulates | dbxquery query="select * from tableCompany" ```
    | spath input="SubnetID_IP" path={} ``` extract changes field name ```
    | mvexpand {}
    | spath input={} path=ip_address
   ]
| stats values(Company) as Company values(Location) as Location values(vulnerability) as vulnerability values(score) as score by ip_address&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The result is&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ip_address&lt;/TD&gt;&lt;TD&gt;Company&lt;/TD&gt;&lt;TD&gt;Location&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;vulnerability&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;score&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;192.168.1.1&lt;/TD&gt;&lt;TD&gt;Comp-A&lt;/TD&gt;&lt;TD&gt;Loc-A&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;OpenSSL&lt;/DIV&gt;&lt;DIV class=""&gt;SQL Injection&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;7&lt;/DIV&gt;&lt;DIV class=""&gt;9&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;192.168.1.2&lt;/TD&gt;&lt;TD&gt;Comp-B&lt;/TD&gt;&lt;TD&gt;Loc-B&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;Cross Site-Scripting&lt;/DIV&gt;&lt;DIV class=""&gt;DNS&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;5&lt;/DIV&gt;&lt;DIV class=""&gt;8&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;192.168.1.21&lt;/TD&gt;&lt;TD&gt;Comp-A&lt;/TD&gt;&lt;TD&gt;Loc-A&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;192.168.1.22&lt;/TD&gt;&lt;TD&gt;Comp-B&lt;/TD&gt;&lt;TD&gt;Loc-B&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;192.168.1.23&lt;/TD&gt;&lt;TD&gt;Comp-B&lt;/TD&gt;&lt;TD&gt;Loc-B&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;192.168.1.31&lt;/TD&gt;&lt;TD&gt;Comp-A&lt;/TD&gt;&lt;TD&gt;Loc-A&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;192.168.1.5&lt;/TD&gt;&lt;TD&gt;Comp-E&lt;/TD&gt;&lt;TD&gt;Loc-E&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;192.168.1.52&lt;/TD&gt;&lt;TD&gt;Comp-E&lt;/TD&gt;&lt;TD&gt;Loc-E&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 01:45:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-perform-lookup-from-index-search-with-dbxquery/m-p/651054#M225096</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-07-19T01:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform lookup from index search with dbxquery?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-perform-lookup-from-index-search-with-dbxquery/m-p/651144#M225138</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;Thank you for your help. I tried both of your queries, and they worked exactly shown in your result.&lt;BR /&gt;However, the result combined all the vulnerabilities in one row (OpenSSL and SQL Injection), and all the scores in one row (7 and 9), and after I expanded into a separate row, the score did not match the vulnerability because it got mixed up when it was merged (OpenSSL should have score 7, not both 7 and 9) .&amp;nbsp;&lt;BR /&gt;Please suggest. Thank you&lt;BR /&gt;| search vulnerability=*&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'remove blank space&lt;BR /&gt;| mvexpand vulnerability&lt;BR /&gt;| mvexpand score&lt;/P&gt;&lt;TABLE width="463px"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="105.703px"&gt;ip_address&lt;/TD&gt;&lt;TD width="79.7812px"&gt;Company&lt;/TD&gt;&lt;TD width="74.0156px"&gt;Location&lt;/TD&gt;&lt;TD width="151.234px"&gt;&lt;DIV class=""&gt;vulnerability&lt;/DIV&gt;&lt;/TD&gt;&lt;TD width="51.2656px"&gt;&lt;DIV class=""&gt;score&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="105.703px"&gt;192.168.1.1&lt;/TD&gt;&lt;TD width="79.7812px"&gt;Comp-A&lt;/TD&gt;&lt;TD width="74.0156px"&gt;Loc-A&lt;/TD&gt;&lt;TD width="151.234px"&gt;&lt;DIV class=""&gt;OpenSSL&lt;/DIV&gt;&lt;/TD&gt;&lt;TD width="51.2656px"&gt;&lt;DIV class=""&gt;7&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="105.703px"&gt;192.168.1.1&lt;/TD&gt;&lt;TD width="79.7812px"&gt;Comp-A&lt;/TD&gt;&lt;TD width="74.0156px"&gt;Loc-A&lt;/TD&gt;&lt;TD width="151.234px"&gt;&lt;DIV class=""&gt;SQL Injection&lt;/DIV&gt;&lt;/TD&gt;&lt;TD width="51.2656px"&gt;&lt;DIV class=""&gt;9&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="105.703px"&gt;192.168.1.1&lt;/TD&gt;&lt;TD width="79.7812px"&gt;Comp-A&lt;/TD&gt;&lt;TD width="74.0156px"&gt;Loc-A&lt;/TD&gt;&lt;TD width="151.234px"&gt;&lt;DIV class=""&gt;OpenSSL&lt;/DIV&gt;&lt;/TD&gt;&lt;TD width="51.2656px"&gt;&lt;DIV class=""&gt;7&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="105.703px"&gt;192.168.1.1&lt;/TD&gt;&lt;TD width="79.7812px"&gt;Comp-A&lt;/TD&gt;&lt;TD width="74.0156px"&gt;Loc-A&lt;/TD&gt;&lt;TD width="151.234px"&gt;&lt;DIV class=""&gt;SQL Injection&lt;/DIV&gt;&lt;/TD&gt;&lt;TD width="51.2656px"&gt;&lt;DIV class=""&gt;9&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="105.703px"&gt;192.168.1.2&lt;/TD&gt;&lt;TD width="79.7812px"&gt;Comp-B&lt;/TD&gt;&lt;TD width="74.0156px"&gt;Loc-B&lt;/TD&gt;&lt;TD width="151.234px"&gt;&lt;DIV class=""&gt;Cross Site-Scripting&lt;/DIV&gt;&lt;/TD&gt;&lt;TD width="51.2656px"&gt;&lt;DIV class=""&gt;5&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="105.703px"&gt;192.168.1.2&lt;/TD&gt;&lt;TD width="79.7812px"&gt;Comp-B&lt;/TD&gt;&lt;TD width="74.0156px"&gt;Loc-B&lt;/TD&gt;&lt;TD width="151.234px"&gt;DNS&lt;/TD&gt;&lt;TD width="51.2656px"&gt;8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="105.703px"&gt;192.168.1.2&lt;/TD&gt;&lt;TD width="79.7812px"&gt;Comp-B&lt;/TD&gt;&lt;TD width="74.0156px"&gt;Loc-B&lt;/TD&gt;&lt;TD width="151.234px"&gt;&lt;DIV class=""&gt;Cross Site-Scripting&lt;/DIV&gt;&lt;/TD&gt;&lt;TD width="51.2656px"&gt;&lt;DIV class=""&gt;5&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="105.703px"&gt;192.168.1.2&lt;/TD&gt;&lt;TD width="79.7812px"&gt;Comp-B&lt;/TD&gt;&lt;TD width="74.0156px"&gt;Loc-B&lt;/TD&gt;&lt;TD width="151.234px"&gt;DNS&lt;/TD&gt;&lt;TD width="51.2656px"&gt;8&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Wed, 19 Jul 2023 16:10:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-perform-lookup-from-index-search-with-dbxquery/m-p/651144#M225138</guid>
      <dc:creator>LearningGuy</dc:creator>
      <dc:date>2023-07-19T16:10:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform lookup from index search with dbxquery?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-perform-lookup-from-index-search-with-dbxquery/m-p/651232#M225149</link>
      <description>&lt;P&gt;To put each vulnerability and score pair in a single row, first pair them then split them.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=vulnerability_index
| table ip_address, vulnerability, score
| append
    [| dbxquery query="select * from tableCompany" ```select ip_address,company,location from tableCompany```
    | spath input="SubnetID-IP" path={}
    | mvexpand {}
    | spath input={} path=ip_address
    | table Company, Location, ip_address ]
| stats values(Company) as Company values(Location) as Location values(eval(vulnerability. "&amp;lt;:&amp;gt;" . score)) as vulnerability by ip_address
| mvexpand vulnerability
| eval vulnerability = split(vulnerability, "&amp;lt;:&amp;gt;")
| eval score = mvindex(vulnerability, 1), vulnerability = mvindex(vulnerability, 0)&lt;/LI-CODE&gt;&lt;P&gt;(The reason why I'm using a complex join-split pattern is because vulnerability may contain common separator characters.)&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2023 02:12:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-perform-lookup-from-index-search-with-dbxquery/m-p/651232#M225149</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-07-20T02:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform lookup from index search with dbxquery?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-perform-lookup-from-index-search-with-dbxquery/m-p/651566#M225250</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;Thanks for your help.&amp;nbsp;&lt;BR /&gt;Your suggestion worked fine on the emulated data, it still needs to filter out empty vulnerability (&amp;nbsp; | search vulnerability=*)&lt;BR /&gt;In real data, your query worked with the following findings:&lt;BR /&gt;1) Very slow&lt;BR /&gt;2) Location field also has "merged" data&lt;BR /&gt;3) There are additional fields that need to be merged using ("&amp;lt;:&amp;gt;"), then expand - which may cause more slowness&lt;BR /&gt;&lt;BR /&gt;I will accept your solution in here&lt;BR /&gt;Do you have any other alternative solutions?&lt;BR /&gt;Can you perhaps give a simple example using external lookup - inside python code?&lt;BR /&gt;Thank you so much.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2023 23:17:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-perform-lookup-from-index-search-with-dbxquery/m-p/651566#M225250</guid>
      <dc:creator>LearningGuy</dc:creator>
      <dc:date>2023-07-21T23:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform lookup from index search with dbxquery?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-perform-lookup-from-index-search-with-dbxquery/m-p/651581#M225256</link>
      <description>&lt;P&gt;You can use the job inspector (in the Job menu) to gain some insight about time consumption. &amp;nbsp;But performance tuning with Splunk - or any program, can be complicated. &amp;nbsp;A lot depend on data characteristics. &amp;nbsp;The interaction between dbxquery and an external database makes improvement even trickier.&lt;/P&gt;&lt;P&gt;Without knowing characteristics of dbxquery, I can think of the following&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If there are many entries without vulnerabilities, removing them early can reduce the number of wasted row calculations.&lt;/LI&gt;&lt;LI&gt;Whereas join-mvexpand-split used to be the main weapon in SPL to handle this type of multivalue problems, Splunk 8 introduced&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/JSONFunctions" target="_blank" rel="noopener"&gt;JSON functions&lt;/A&gt;&amp;nbsp;as a stand-in for hash datatype. &amp;nbsp;I have no insight into how efficient they are, but using split and mvindex on every row must be more expensive.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Combining these two thoughts, you can try the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=vulnerability_index
| eval vulnerability = json_object("vulnerability", vulnerability, "score", score)
``` table at this point is generally a waste ```
| append
    [| dbxquery query="select * from tableCompany" ```select 'SubnetID-IP',company,location from tableCompany```
    | spath input="SubnetID-IP" path={}
    | mvexpand {}
    | spath input={} path=ip_address ]
| stats values(Company) as Company values(Location) as Location values(vulnerability) as vulnerability by ip_address
| stats values(ip_address) as ip_address by Company Location vulnerability
``` this automatically eliminates rows without vulnerability ```
| eval score = json_extract(vulnerability, "score"), vulnerability = json_extract(vulnerability, "vulnerability")
| table ip_address Company Location vulnerability score&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can also reduce number of rows by restricting dbxquery to only SubnetID-IP that the vulnerability_index search returns with a subsearch. &amp;nbsp;How to do this depends on the real index search. (I suspect that you are not returning the entire index in the real job.)&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jul 2023 07:33:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-perform-lookup-from-index-search-with-dbxquery/m-p/651581#M225256</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-07-22T07:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform lookup from index search with dbxquery?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-perform-lookup-from-index-search-with-dbxquery/m-p/651820#M225316</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;Thanks for your help. I was able to run your JSON query just fine. It turned out that one ip_address can be used in multiple company, so the merged data now is in "vulnerability" , "company", and "location" field&lt;BR /&gt;1. Is it possible to use lookup from index to Dbx query?&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;When I used lookup from index to CSV, it only returns merged data on the CSV side, not on the index side&lt;BR /&gt;2. Why don't we use JOIN?&lt;BR /&gt;&lt;BR /&gt;Before parse:&lt;/P&gt;&lt;TABLE width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="20%"&gt;&lt;P&gt;company&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;TD width="17%"&gt;&lt;P&gt;location&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;TD width="62%"&gt;&lt;P&gt;SubnetID-IP&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%"&gt;&lt;P&gt;Comp-A&lt;/P&gt;&lt;/TD&gt;&lt;TD width="17%"&gt;&lt;P&gt;Loc- A&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;TD width="62%"&gt;&lt;P&gt;&amp;nbsp;[{"subnet_id":"101","ip_address":"192.168.1.1"},&lt;BR /&gt;{"subnet_id":"121","ip_address":"192.168.1.21"},&lt;BR /&gt;{"subnet_id":"131","ip_address":"192.168.1.31"}]&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%"&gt;&lt;P&gt;Comp-Z&lt;/P&gt;&lt;/TD&gt;&lt;TD width="17%"&gt;&lt;P&gt;Loc- Z&lt;/P&gt;&lt;/TD&gt;&lt;TD width="62%"&gt;&lt;P&gt;&amp;nbsp;[{"subnet_id":"101","ip_address":"192.168.1.1"},&lt;BR /&gt;{"subnet_id":"121","ip_address":"192.168.1.21"},&lt;BR /&gt;{"subnet_id":"131","ip_address":"192.168.1.31"}]&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%"&gt;&lt;P&gt;Comp-B&lt;/P&gt;&lt;/TD&gt;&lt;TD width="17%"&gt;&lt;P&gt;Loc-B&lt;/P&gt;&lt;/TD&gt;&lt;TD width="62%"&gt;&lt;P&gt;&amp;nbsp;[{"subnet_id":"102","ip_address":"192.168.1.2"},&lt;BR /&gt;{"subnet_id":"122","ip_address":"192.168.1.22"},&lt;BR /&gt;{"subnet_id":"123","ip_address":"192.168.1.23"}]&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%"&gt;&lt;P&gt;Comp-Y&lt;/P&gt;&lt;/TD&gt;&lt;TD width="17%"&gt;&lt;P&gt;Loc-Y&lt;/P&gt;&lt;/TD&gt;&lt;TD width="62%"&gt;&lt;P&gt;&amp;nbsp;[{"subnet_id":"102","ip_address":"192.168.1.2"},&lt;BR /&gt;{"subnet_id":"122","ip_address":"192.168.1.22"},&lt;BR /&gt;{"subnet_id":"123","ip_address":"192.168.1.23"}]&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%"&gt;&lt;P&gt;Comp-E&lt;/P&gt;&lt;/TD&gt;&lt;TD width="17%"&gt;&lt;P&gt;Loc-E&lt;/P&gt;&lt;/TD&gt;&lt;TD width="62%"&gt;&lt;P&gt;[{"subnet_id":"105","ip_address":"192.168.1.5"},&lt;BR /&gt;{"subnet_id":"152","ip_address":"192.168.1.52"}]&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;After Parse:&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="119px" height="40px"&gt;&lt;P&gt;ip_address&lt;/P&gt;&lt;/TD&gt;&lt;TD width="114px" height="40px"&gt;&lt;P&gt;company&lt;/P&gt;&lt;/TD&gt;&lt;TD width="389px" height="40px"&gt;&lt;P&gt;location&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="119px" height="40px"&gt;&lt;P&gt;192.168.1.1&lt;/P&gt;&lt;/TD&gt;&lt;TD width="114px" height="40px"&gt;&lt;P&gt;Comp-A&lt;/P&gt;&lt;/TD&gt;&lt;TD width="389px" height="40px"&gt;&lt;P&gt;Loc-A&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="119px" height="40px"&gt;&lt;P&gt;192.168.1.1&lt;/P&gt;&lt;/TD&gt;&lt;TD width="114px" height="40px"&gt;&lt;P&gt;Comp-Z&lt;/P&gt;&lt;/TD&gt;&lt;TD width="389px" height="40px"&gt;&lt;P&gt;Loc-Z&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="119px" height="40px"&gt;&lt;P&gt;192.168.1.2&lt;/P&gt;&lt;/TD&gt;&lt;TD width="114px" height="40px"&gt;&lt;P&gt;Comp-B&lt;/P&gt;&lt;/TD&gt;&lt;TD width="389px" height="40px"&gt;&lt;P&gt;Loc-B&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="119px" height="40px"&gt;&lt;P&gt;192.168.1.2&lt;/P&gt;&lt;/TD&gt;&lt;TD width="114px" height="40px"&gt;&lt;P&gt;Comp-Y&lt;/P&gt;&lt;/TD&gt;&lt;TD width="389px" height="40px"&gt;&lt;P&gt;Loc-Y&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="119px" height="40px"&gt;&lt;P&gt;192.168.1.5&lt;/P&gt;&lt;/TD&gt;&lt;TD width="114px" height="40px"&gt;&lt;P&gt;Comp-E&lt;/P&gt;&lt;/TD&gt;&lt;TD width="389px" height="40px"&gt;&lt;P&gt;Loc-E&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;After append:&amp;nbsp; both vulnerability and company are merged&lt;/P&gt;&lt;TABLE width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="20%"&gt;&lt;P&gt;ip_address&lt;/P&gt;&lt;/TD&gt;&lt;TD width="20%"&gt;&lt;P&gt;vulnerability&lt;/P&gt;&lt;/TD&gt;&lt;TD width="20%"&gt;&lt;P&gt;score&lt;/P&gt;&lt;/TD&gt;&lt;TD width="20%"&gt;&lt;P&gt;company&lt;/P&gt;&lt;/TD&gt;&lt;TD width="16%"&gt;&lt;P&gt;location&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%"&gt;&lt;P&gt;192.168.1.1&lt;/P&gt;&lt;/TD&gt;&lt;TD width="20%"&gt;&lt;P&gt;OpenSSL&lt;BR /&gt;SQL Injection&lt;/P&gt;&lt;/TD&gt;&lt;TD width="20%"&gt;&lt;P&gt;7&lt;/P&gt;&lt;/TD&gt;&lt;TD width="20%"&gt;&lt;P&gt;Comp-A&lt;BR /&gt;Comp-Z&lt;/P&gt;&lt;/TD&gt;&lt;TD width="16%"&gt;&lt;P&gt;Loc-A&lt;BR /&gt;Loc-Z&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%"&gt;&lt;P&gt;192.168.1.2&lt;/P&gt;&lt;/TD&gt;&lt;TD width="20%"&gt;&lt;P&gt;Cross Site-Scripting&lt;BR /&gt;DNS&lt;/P&gt;&lt;/TD&gt;&lt;TD width="20%"&gt;&lt;P&gt;8&lt;/P&gt;&lt;/TD&gt;&lt;TD width="20%"&gt;&lt;P&gt;Comp-B&lt;BR /&gt;Comp-Y&lt;/P&gt;&lt;/TD&gt;&lt;TD width="16%"&gt;&lt;P&gt;Loc-B&lt;BR /&gt;Loc-Y&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expected result:&lt;/P&gt;&lt;TABLE width="92%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="21%"&gt;&lt;P&gt;ip_address&lt;/P&gt;&lt;/TD&gt;&lt;TD width="32%"&gt;&lt;P&gt;vulnerability&lt;/P&gt;&lt;/TD&gt;&lt;TD width="15%"&gt;&lt;P&gt;score&lt;/P&gt;&lt;/TD&gt;&lt;TD width="15%"&gt;&lt;P&gt;company&lt;/P&gt;&lt;/TD&gt;&lt;TD width="15%"&gt;&lt;P&gt;location&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="21%"&gt;&lt;P&gt;192.168.1.1&lt;/P&gt;&lt;/TD&gt;&lt;TD width="32%"&gt;&lt;P&gt;OpenSSL&lt;/P&gt;&lt;/TD&gt;&lt;TD width="15%"&gt;&lt;P&gt;7&lt;/P&gt;&lt;/TD&gt;&lt;TD width="15%"&gt;&lt;P&gt;Comp-A&lt;/P&gt;&lt;/TD&gt;&lt;TD width="15%"&gt;&lt;P&gt;Loc-A&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="21%"&gt;&lt;P&gt;192.168.1.1&lt;/P&gt;&lt;/TD&gt;&lt;TD width="32%"&gt;&lt;P&gt;SQL Injection&lt;/P&gt;&lt;/TD&gt;&lt;TD width="15%"&gt;&lt;P&gt;9&lt;/P&gt;&lt;/TD&gt;&lt;TD width="15%"&gt;&lt;P&gt;Comp-Z&lt;/P&gt;&lt;/TD&gt;&lt;TD width="15%"&gt;&lt;P&gt;Loc-A&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="21%"&gt;&lt;P&gt;192.168.1.2&lt;/P&gt;&lt;/TD&gt;&lt;TD width="32%"&gt;&lt;P&gt;Cross Site-Scripting&lt;/P&gt;&lt;/TD&gt;&lt;TD width="15%"&gt;&lt;P&gt;8&lt;/P&gt;&lt;/TD&gt;&lt;TD width="15%"&gt;&lt;P&gt;Comp-B&lt;/P&gt;&lt;/TD&gt;&lt;TD width="15%"&gt;&lt;P&gt;Loc-B&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="21%"&gt;&lt;P&gt;192.168.1.2&lt;/P&gt;&lt;/TD&gt;&lt;TD width="32%"&gt;&lt;P&gt;DNS&lt;/P&gt;&lt;/TD&gt;&lt;TD width="15%"&gt;&lt;P&gt;5&lt;/P&gt;&lt;/TD&gt;&lt;TD width="15%"&gt;&lt;P&gt;Comp-Y&lt;/P&gt;&lt;/TD&gt;&lt;TD width="15%"&gt;&lt;P&gt;Loc-B&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 25 Jul 2023 02:42:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-perform-lookup-from-index-search-with-dbxquery/m-p/651820#M225316</guid>
      <dc:creator>LearningGuy</dc:creator>
      <dc:date>2023-07-25T02:42:18Z</dc:date>
    </item>
  </channel>
</rss>

