<?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 using lookup without common field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/using-lookup-without-common-field/m-p/673627#M230657</link>
    <description>&lt;P&gt;Hi Splunkers,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;I'm having a lookup country_categorization, which have the keyword and its equivalent country, we need to use this info for the main search asset when the country field from index is "not available" or "Unknown", we need to use this keyword from lookup, need to compare with asset name with index, usually keyqords are set of prefix of asset name with multiple entries and it should match with equivalent country.&lt;/P&gt;&lt;P&gt;Index-&lt;/P&gt;&lt;P&gt;Asset, country&lt;BR /&gt;braiskdidi001, Britain&lt;/P&gt;&lt;P&gt;breliudusfidf002, Unknown&lt;/P&gt;&lt;P&gt;bruliwhdcjn001, not available&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;lookup&lt;/P&gt;&lt;P&gt;keyword, country&lt;/P&gt;&lt;P&gt;bru - Britain&lt;BR /&gt;bre - Britain&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the output should be&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;braiskdidi001, Britain&lt;/P&gt;&lt;P&gt;breliudusfidf002, Britain&lt;/P&gt;&lt;P&gt;bruliwhdcjn001, Britain.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks in Advance!&lt;/P&gt;&lt;P&gt;Manoj Kumar S&lt;/P&gt;</description>
    <pubDate>Tue, 09 Jan 2024 11:46:27 GMT</pubDate>
    <dc:creator>smanojkumar</dc:creator>
    <dc:date>2024-01-09T11:46:27Z</dc:date>
    <item>
      <title>using lookup without common field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-lookup-without-common-field/m-p/673627#M230657</link>
      <description>&lt;P&gt;Hi Splunkers,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;I'm having a lookup country_categorization, which have the keyword and its equivalent country, we need to use this info for the main search asset when the country field from index is "not available" or "Unknown", we need to use this keyword from lookup, need to compare with asset name with index, usually keyqords are set of prefix of asset name with multiple entries and it should match with equivalent country.&lt;/P&gt;&lt;P&gt;Index-&lt;/P&gt;&lt;P&gt;Asset, country&lt;BR /&gt;braiskdidi001, Britain&lt;/P&gt;&lt;P&gt;breliudusfidf002, Unknown&lt;/P&gt;&lt;P&gt;bruliwhdcjn001, not available&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;lookup&lt;/P&gt;&lt;P&gt;keyword, country&lt;/P&gt;&lt;P&gt;bru - Britain&lt;BR /&gt;bre - Britain&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the output should be&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;braiskdidi001, Britain&lt;/P&gt;&lt;P&gt;breliudusfidf002, Britain&lt;/P&gt;&lt;P&gt;bruliwhdcjn001, Britain.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks in Advance!&lt;/P&gt;&lt;P&gt;Manoj Kumar S&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2024 11:46:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-lookup-without-common-field/m-p/673627#M230657</guid>
      <dc:creator>smanojkumar</dc:creator>
      <dc:date>2024-01-09T11:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: using lookup without common field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-lookup-without-common-field/m-p/673630#M230659</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval keyword=substr(Asset,0,3)
| lookup country_categorization keyword&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 09 Jan 2024 12:12:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-lookup-without-common-field/m-p/673630#M230659</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-01-09T12:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: using lookup without common field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-lookup-without-common-field/m-p/673642#M230663</link>
      <description>&lt;P&gt;This sounds like a good use case to utilize the WILDCARD(keyword) capability within advanced settings in lookup definitions.&lt;BR /&gt;&lt;BR /&gt;I tried it out on a local instance and think I got what you are looking for.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dtburrows3_0-1704810141302.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/28806iBEC01D279C132FE3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dtburrows3_0-1704810141302.png" alt="dtburrows3_0-1704810141302.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Wildcards will need to be included in the lookup though so would look like this.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dtburrows3_1-1704809833975.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/28804iE3B1896F9836B875/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dtburrows3_1-1704809833975.png" alt="dtburrows3_1-1704809833975.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;And if you are only looking for matches against the beginning of the "Asset" field value then you can also just set up the wildcards on the end of the values in lookup (This example also has a net-new field in lookup to retain the original keyword value in the lookup in case it is needed elsewhere)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dtburrows3_1-1704810433930.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/28807i96ED1ECE303710AD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dtburrows3_1-1704810433930.png" alt="dtburrows3_1-1704810433930.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and under the advanced settings checkbox in the lookup definition you would configure the field "keyword" to match with wildcards like this (you can turn off case-sensitivity too.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dtburrows3_2-1704809907666.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/28805i12DEAA93B142A2A7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dtburrows3_2-1704809907666.png" alt="dtburrows3_2-1704809907666.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: If you decide to go with the wildcard match using a new "keyword_wildcard" field from lookup you will have to adjust the lookup definition advanced settings to WILDCARD(keyword_wildcard) instead.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dtburrows3_2-1704810567485.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/28808i6F48C4D4F07A1B42/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dtburrows3_2-1704810567485.png" alt="dtburrows3_2-1704810567485.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example SPL:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;base_search&amp;gt;
    | lookup splunk_community_keyword_association keyword as Asset OUTPUT country as match_country
    | eval
        country=coalesce(if(NOT match(country, "^(?i)(?:unknown|not\s+available|n\/a|na)$"), 'country', null()), 'match_country')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Full SPL to simulate:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
    | eval
        Asset="braiskdidi001",
        country="Britain"
    | append
        [
            | makeresults
                | eval
                    Asset="breliudusfidf002",
                    country="Unknown"
            ]
    | append
        [
            | makeresults
                | eval
                    Asset="bruliwhdcjn001",
                    country="not available"
            ]
    | rename
        country as country_from_index
    ``` lookup wildcard match against Asset field value to the keyword_wildcard field in lookup and return the country if match is found ```
    | lookup splunk_community_keyword_association keyword_wildcard as Asset OUTPUT country as country_from_lookup
    ``` evaluate new country field that uses derived country from lookup if a match is found and the country_from_index indicates that it was not found ```
    | eval
        coalesced_country=coalesce(if(NOT match(country_from_index, "^(?i)(?:unknown|not\s+available|n\/a|na)$"), 'country_from_index', null()), 'country_from_lookup')
    | fields + _time, Asset, country_from_index, country_from_lookup, coalesced_country&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;Referenced splunk_community_keyword_association.csv&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;country&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;keyword&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;keyword_wildcard&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;Britain&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;bru&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;bru*&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;Britain&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;bre&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;bre*&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;USA&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;usa&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;usa*&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 09 Jan 2024 14:35:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-lookup-without-common-field/m-p/673642#M230663</guid>
      <dc:creator>dtburrows3</dc:creator>
      <dc:date>2024-01-09T14:35:49Z</dc:date>
    </item>
  </channel>
</rss>

