<?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: Matching a search (with spath) and Inputlookup in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Matching-a-search-with-spath-and-Inputlookup/m-p/524098#M147864</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/227423"&gt;@knadav&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can I use a regular lookup instead of using&amp;nbsp;inputlookup? /// Yes, the inputlookup is to "view" the contents of a lookup file. The regular "lookup" is to&amp;nbsp;&lt;SPAN&gt;invoke field value lookups, which is exactly your use-case.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What should be the&amp;nbsp;&lt;STRONG&gt;required-field&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&amp;nbsp;&lt;STRONG&gt;required-field-values&amp;nbsp;&lt;/STRONG&gt;values you wrote? // lets understand from the splunk documentation..&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mw-headline"&gt;1. Lookup users and return the corresponding group the user belongs to&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Suppose you have a lookup table specified in a stanza named&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;usertogroup&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;in the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;transforms.conf&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;file. This lookup table contains (at least) two fields,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;user&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;group. Your events contain a field called&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;local_user. For each event, the following search checks to see if the value in the field&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;local_user&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;has a corresponding value in the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;user&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;field in the lookup table. For any entries that match, the value of the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;group&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;field in the lookup table is written to the field&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;user_group&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;in the event.&lt;/P&gt;&lt;P class="inlineQuery"&gt;... | lookup usertogroup user as local_user OUTPUT group as user_group&lt;/P&gt;&lt;P class="inlineQuery"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="inlineQuery"&gt;let me assume that, your lookup all_identities.csv got two fields: userid and email. so, now from the first search you get email id as EmailAddr, you will match it with your inputlookup csv file and then by using OUTPUT (or OUTPUTNEW), you will list down the userid as UserName. hope its clear now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="MyIndex" some search filters | spath "EmailAddr" | table EmailAddr 
| lookup all_identities.csv email as EmailAddr OUTPUT userid as UserName&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="inlineQuery"&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 11 Oct 2020 16:43:07 GMT</pubDate>
    <dc:creator>inventsekar</dc:creator>
    <dc:date>2020-10-11T16:43:07Z</dc:date>
    <item>
      <title>Matching a search (with spath) and Inputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-a-search-with-spath-and-Inputlookup/m-p/524080#M147861</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;I'm trying to match a result from one search to an Inputlookup.&lt;/P&gt;&lt;P&gt;The original search contains "spath" command because the source sends the logs in JSON format.&lt;/P&gt;&lt;P&gt;Here is the first search:&lt;/P&gt;&lt;P&gt;index="MyIndex" some search filters | spath "EmailAddr" | table "EmailAddr"&lt;/P&gt;&lt;P&gt;Here is the second search:&lt;/P&gt;&lt;P&gt;[| inputlookup all_identities.csv | fields email ]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The end goal is to take the "EmailAddr" from the first search and match it with the field "email" from the second search so only email addresses that are in the inputlookup will return from the search.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The email address needs to be in both the search and the inputlookup.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried to use the | eval email = spath(_raw,"email") command to place the "email" value in the eval field but that did not do the job.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would really appreciate the community help on this.&lt;/P&gt;&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Oct 2020 14:53:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-a-search-with-spath-and-Inputlookup/m-p/524080#M147861</guid>
      <dc:creator>knadav</dc:creator>
      <dc:date>2020-10-11T14:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: Matching a search (with spath) and Inputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-a-search-with-spath-and-Inputlookup/m-p/524083#M147862</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/227423"&gt;@knadav&lt;/a&gt;&amp;nbsp;all you need is the "lookup" command (please edit it as per your field names and values)&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;index="MyIndex" some search filters | spath "EmailAddr" | table EmailAddr 
| lookup all_identities.csv email EmailAddr OUTPUT required-field as required-field-values &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;lookup command reference:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.6/SearchReference/Lookup" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.6/SearchReference/Lookup&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Oct 2020 15:34:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-a-search-with-spath-and-Inputlookup/m-p/524083#M147862</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2020-10-11T15:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: Matching a search (with spath) and Inputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-a-search-with-spath-and-Inputlookup/m-p/524092#M147863</link>
      <description>&lt;P&gt;Hi&amp;nbsp;inventsekar,&lt;/P&gt;&lt;P&gt;Can I use a regular lookup instead of using&amp;nbsp;inputlookup?&lt;/P&gt;&lt;P&gt;I've tried to do the query you provided and had no success.&lt;/P&gt;&lt;P&gt;What should be the&amp;nbsp;&lt;STRONG&gt;required-field&lt;/STRONG&gt; and&amp;nbsp;&lt;STRONG&gt;required-field-values&amp;nbsp;&lt;/STRONG&gt;values you wrote?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Oct 2020 16:11:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-a-search-with-spath-and-Inputlookup/m-p/524092#M147863</guid>
      <dc:creator>knadav</dc:creator>
      <dc:date>2020-10-11T16:11:19Z</dc:date>
    </item>
    <item>
      <title>Re: Matching a search (with spath) and Inputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-a-search-with-spath-and-Inputlookup/m-p/524098#M147864</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/227423"&gt;@knadav&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can I use a regular lookup instead of using&amp;nbsp;inputlookup? /// Yes, the inputlookup is to "view" the contents of a lookup file. The regular "lookup" is to&amp;nbsp;&lt;SPAN&gt;invoke field value lookups, which is exactly your use-case.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What should be the&amp;nbsp;&lt;STRONG&gt;required-field&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&amp;nbsp;&lt;STRONG&gt;required-field-values&amp;nbsp;&lt;/STRONG&gt;values you wrote? // lets understand from the splunk documentation..&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mw-headline"&gt;1. Lookup users and return the corresponding group the user belongs to&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Suppose you have a lookup table specified in a stanza named&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;usertogroup&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;in the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;transforms.conf&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;file. This lookup table contains (at least) two fields,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;user&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;group. Your events contain a field called&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;local_user. For each event, the following search checks to see if the value in the field&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;local_user&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;has a corresponding value in the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;user&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;field in the lookup table. For any entries that match, the value of the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;group&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;field in the lookup table is written to the field&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;user_group&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;in the event.&lt;/P&gt;&lt;P class="inlineQuery"&gt;... | lookup usertogroup user as local_user OUTPUT group as user_group&lt;/P&gt;&lt;P class="inlineQuery"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="inlineQuery"&gt;let me assume that, your lookup all_identities.csv got two fields: userid and email. so, now from the first search you get email id as EmailAddr, you will match it with your inputlookup csv file and then by using OUTPUT (or OUTPUTNEW), you will list down the userid as UserName. hope its clear now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="MyIndex" some search filters | spath "EmailAddr" | table EmailAddr 
| lookup all_identities.csv email as EmailAddr OUTPUT userid as UserName&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="inlineQuery"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Oct 2020 16:43:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-a-search-with-spath-and-Inputlookup/m-p/524098#M147864</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2020-10-11T16:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: Matching a search (with spath) and Inputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-a-search-with-spath-and-Inputlookup/m-p/524099#M147865</link>
      <description>&lt;P&gt;Hi inventsekar,&lt;/P&gt;&lt;P&gt;When trying to add the "EmailAddr" to the lookup command - I'm receiving the following error:&lt;/P&gt;&lt;P&gt;"Error in 'lookup' command: Could not find all of the specified lookup fields in the lookup table."&lt;/P&gt;&lt;P&gt;This is most likely because the field "EmailAddr" is not in the lookup but only in the base search.&lt;/P&gt;&lt;P&gt;How can I proceed?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate your assistance!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Oct 2020 16:47:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-a-search-with-spath-and-Inputlookup/m-p/524099#M147865</guid>
      <dc:creator>knadav</dc:creator>
      <dc:date>2020-10-11T16:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: Matching a search (with spath) and Inputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-a-search-with-spath-and-Inputlookup/m-p/524102#M147867</link>
      <description>&lt;P&gt;1. may we know your all_identities.csv field names please.&lt;/P&gt;&lt;P&gt;2. and what happens when you run this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults | eval EmailAddr="UseMailidthatExistinUrinputlookup" 
| lookup all_identities.csv email as EmailAddr OUTPUT userid as UserName&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. i think the spath command needs some editing. pls check this once:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/8.0.2007/SearchReference/spath#Basic_examples" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/SplunkCloud/8.0.2007/SearchReference/spath#Basic_examples&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS - Karma points appreciated!&lt;/P&gt;</description>
      <pubDate>Sun, 11 Oct 2020 17:09:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-a-search-with-spath-and-Inputlookup/m-p/524102#M147867</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2020-10-11T17:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: Matching a search (with spath) and Inputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-a-search-with-spath-and-Inputlookup/m-p/524115#M147871</link>
      <description>&lt;P&gt;Hi inventskear,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately cannot share all the field names but i'm making the proper adjustments as we go &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When running the command you provided, i'm getting good results with the proper fields!&amp;nbsp;&lt;/P&gt;&lt;P&gt;When trying to add the two searches together i'm receiving the following alert:&amp;nbsp;&lt;/P&gt;&lt;P&gt;"Streamed search execute failed because: Error in 'lookup' command: Could not construct lookup 'all_identities.csv, email, as, EmailAddr, OUTPUT, identity, as, UserName'."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To work with the spath field I've used the following command:&lt;/P&gt;&lt;P&gt;| eval EmailAddr = spath(_raw,"EmailAddr")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How should I proceed?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Sun, 11 Oct 2020 18:41:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-a-search-with-spath-and-Inputlookup/m-p/524115#M147871</guid>
      <dc:creator>knadav</dc:creator>
      <dc:date>2020-10-11T18:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: Matching a search (with spath) and Inputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-a-search-with-spath-and-Inputlookup/m-p/524116#M147872</link>
      <description>&lt;P&gt;The spath and eval looks not correct to me. Without the lookup, if you run the first part alone(spath and then add a "table EmailAddr" ) .. and see if it works.&lt;/P&gt;&lt;P&gt;As per understanding, spath should be...&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;| spath output=EmailAddr path=path.to.EmailAddr.inxml&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;From the error msg, it seems you added more comma.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The lookup part alone:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"| lookup all_identities.csv email AS EmailAddr OUTPUT identity AS UserName"&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Oct 2020 19:06:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-a-search-with-spath-and-Inputlookup/m-p/524116#M147872</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2020-10-11T19:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: Matching a search (with spath) and Inputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-a-search-with-spath-and-Inputlookup/m-p/524133#M147876</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/227423"&gt;@knadav&lt;/a&gt;&amp;nbsp;let us know if that spath issue and lookup are solved. let us know your final command, so it will be helpful to the new readers. if issue resolved, please accept it as solution. thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Oct 2020 02:31:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-a-search-with-spath-and-Inputlookup/m-p/524133#M147876</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2020-10-12T02:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Matching a search (with spath) and Inputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-a-search-with-spath-and-Inputlookup/m-p/524229#M147891</link>
      <description>&lt;P&gt;After a few adjustments - This worked like a charm!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate it&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Oct 2020 13:17:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-a-search-with-spath-and-Inputlookup/m-p/524229#M147891</guid>
      <dc:creator>knadav</dc:creator>
      <dc:date>2020-10-12T13:17:18Z</dc:date>
    </item>
  </channel>
</rss>

