<?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 do you build a lookup table name during runtime of the query? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-build-a-lookup-table-name-during-runtime-of-the-query/m-p/453861#M128426</link>
    <description>&lt;P&gt;@seomisp, if you have only two values for type i.e. &lt;CODE&gt;type1&lt;/CODE&gt; and &lt;CODE&gt;type2&lt;/CODE&gt;, one of the options would be use multisearch command with each type in the filter for respective search.&lt;/P&gt;

&lt;P&gt;PS: The &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Multisearch"&gt;multisearch&lt;/A&gt; command joins two searches with streaming command without sub-search limitations.&lt;/P&gt;

&lt;P&gt;Following is a sample search based on your question:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=X | eval t="LT_".type | lookup t type
    | multisearch 
        [ search index=X type="type1" 
        | lookup LY_type1 type] 
        [  search index=X type="type2" 
        | lookup LY_type2 type]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 27 Oct 2018 15:46:10 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2018-10-27T15:46:10Z</dc:date>
    <item>
      <title>How do you build a lookup table name during runtime of the query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-build-a-lookup-table-name-during-runtime-of-the-query/m-p/453860#M128425</link>
      <description>&lt;P&gt;I have a few lookup tables that I need to query against. For example:&lt;/P&gt;

&lt;P&gt;LT_type1&lt;BR /&gt;
LT_type2&lt;/P&gt;

&lt;P&gt;Depending on my search, the type1 or type2 will be different. My initial thought was to build the name of the lookup table on the fly. The "_type1" part of the lookup table name will come from the field "type" of my search on index X. The Lookup table also as a field with the name as the same value as "type":&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=X | eval t="LT_".type | lookup t type
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get an error saying lookup t doesn't exist. Any ideas how to do this?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:49:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-build-a-lookup-table-name-during-runtime-of-the-query/m-p/453860#M128425</guid>
      <dc:creator>seomisp</dc:creator>
      <dc:date>2020-09-29T21:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do you build a lookup table name during runtime of the query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-build-a-lookup-table-name-during-runtime-of-the-query/m-p/453861#M128426</link>
      <description>&lt;P&gt;@seomisp, if you have only two values for type i.e. &lt;CODE&gt;type1&lt;/CODE&gt; and &lt;CODE&gt;type2&lt;/CODE&gt;, one of the options would be use multisearch command with each type in the filter for respective search.&lt;/P&gt;

&lt;P&gt;PS: The &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Multisearch"&gt;multisearch&lt;/A&gt; command joins two searches with streaming command without sub-search limitations.&lt;/P&gt;

&lt;P&gt;Following is a sample search based on your question:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=X | eval t="LT_".type | lookup t type
    | multisearch 
        [ search index=X type="type1" 
        | lookup LY_type1 type] 
        [  search index=X type="type2" 
        | lookup LY_type2 type]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 27 Oct 2018 15:46:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-build-a-lookup-table-name-during-runtime-of-the-query/m-p/453861#M128426</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-10-27T15:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do you build a lookup table name during runtime of the query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-build-a-lookup-table-name-during-runtime-of-the-query/m-p/453862#M128427</link>
      <description>&lt;P&gt;"type1" and "type2" was just an example. I have more than 2 types.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Oct 2018 18:23:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-build-a-lookup-table-name-during-runtime-of-the-query/m-p/453862#M128427</guid>
      <dc:creator>seomisp</dc:creator>
      <dc:date>2018-10-29T18:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do you build a lookup table name during runtime of the query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-build-a-lookup-table-name-during-runtime-of-the-query/m-p/453863#M128428</link>
      <description>&lt;P&gt;index=X | eval t="LT_".type &lt;BR /&gt;
|stats count by t&lt;BR /&gt;
|map maxsearches=10 search="index=X | eval t=$t$ | lookup $t$ type "&lt;/P&gt;</description>
      <pubDate>Sat, 22 Dec 2018 00:19:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-build-a-lookup-table-name-during-runtime-of-the-query/m-p/453863#M128428</guid>
      <dc:creator>valiquet</dc:creator>
      <dc:date>2018-12-22T00:19:34Z</dc:date>
    </item>
  </channel>
</rss>

