<?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: Optimizing subquery with inputlookup in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Optimizing-subquery-with-inputlookup/m-p/648564#M224372</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/224785"&gt;@krbalaji77&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;the error is to use the join command that must be used only when there isn't any other solution.&lt;/P&gt;&lt;P&gt;Splunk isn't a database!&lt;/P&gt;&lt;P&gt;In addition you used the search as subquery and you have the limit of 50,000 results.&lt;/P&gt;&lt;P&gt;You should use a different approach using your lookup:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=os sourcetype=ps "abc.pid" OR "abc.bin"
| eval host=lower(host)
| stats count BY host
| append [ | inputlookup lookup.csv | eval host=lower(host), count=0 | fields host count ]
| join type=outer [search  ]
| stats sum(count) AS total BY host
| where total=0&lt;/LI-CODE&gt;&lt;P&gt;This is a more performant search.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Wed, 28 Jun 2023 15:35:48 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2023-06-28T15:35:48Z</dc:date>
    <item>
      <title>Optimizing subquery with inputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Optimizing-subquery-with-inputlookup/m-p/648563#M224371</link>
      <description>&lt;P&gt;I have this query to find hosts from a lookup that have zero events. There are about a 100 hosts and I can see that the query performance is slow with the use of subquery this way.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas to improve this?&lt;/P&gt;&lt;P&gt;| inputlookup lookup.csv&lt;BR /&gt;| join type=outer [search index=os sourcetype=ps "abc.pid" OR "abc.bin"&lt;BR /&gt;| stats count as heartbeat by host ]&lt;BR /&gt;| fillnull heartbeat value=0&lt;BR /&gt;| where heartbeat=0&lt;BR /&gt;| stats values(host) as failed_hosts&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2023 15:28:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Optimizing-subquery-with-inputlookup/m-p/648563#M224371</guid>
      <dc:creator>krbalaji77</dc:creator>
      <dc:date>2023-06-28T15:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: Optimizing subquery with inputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Optimizing-subquery-with-inputlookup/m-p/648564#M224372</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/224785"&gt;@krbalaji77&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;the error is to use the join command that must be used only when there isn't any other solution.&lt;/P&gt;&lt;P&gt;Splunk isn't a database!&lt;/P&gt;&lt;P&gt;In addition you used the search as subquery and you have the limit of 50,000 results.&lt;/P&gt;&lt;P&gt;You should use a different approach using your lookup:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=os sourcetype=ps "abc.pid" OR "abc.bin"
| eval host=lower(host)
| stats count BY host
| append [ | inputlookup lookup.csv | eval host=lower(host), count=0 | fields host count ]
| join type=outer [search  ]
| stats sum(count) AS total BY host
| where total=0&lt;/LI-CODE&gt;&lt;P&gt;This is a more performant search.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2023 15:35:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Optimizing-subquery-with-inputlookup/m-p/648564#M224372</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-06-28T15:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: Optimizing subquery with input lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Optimizing-subquery-with-inputlookup/m-p/648571#M224373</link>
      <description>&lt;P&gt;Thank you for the quick response&amp;nbsp;&lt;SPAN&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;so, we do still need to do a join in this case right meaning the append itself wouldnt do it?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;also - what does this do ?&lt;/P&gt;&lt;PRE&gt;| join type=outer [search  ]&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2023 16:38:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Optimizing-subquery-with-inputlookup/m-p/648571#M224373</guid>
      <dc:creator>krbalaji77</dc:creator>
      <dc:date>2023-06-28T16:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: Optimizing subquery with input lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Optimizing-subquery-with-inputlookup/m-p/648622#M224384</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/224785"&gt;@krbalaji77&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;sorry! it was a typo:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=os sourcetype=ps "abc.pid" OR "abc.bin"
| eval host=lower(host)
| stats count BY host
| append [ | inputlookup lookup.csv | eval host=lower(host), count=0 | fields host count ]
| stats sum(count) AS total BY host
| where total=0&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2023 07:35:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Optimizing-subquery-with-inputlookup/m-p/648622#M224384</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-06-29T07:35:09Z</dc:date>
    </item>
  </channel>
</rss>

