<?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: Help on inputlookup with subsearch in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/Help-on-inputlookup-with-subsearch/m-p/529460#M4160</link>
    <description>&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;table HOSTNAME&lt;/FONT&gt; command discards all other fields so the last lookup is needed to retrieve them again.&lt;/P&gt;&lt;P&gt;Similarly, the fields command also discards all fields except AP, USERNAME, and SEEN so the final lookup is needed.&lt;/P&gt;&lt;P&gt;Why is the query starting with a subsearch?&amp;nbsp; A subsearch adds nothing in this case since it would execute first anyway.&lt;/P&gt;&lt;P&gt;What does the wire macro do?&lt;/P&gt;&lt;P&gt;See if this makes any difference&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup lookup_fo where TYPE="WW" (DOMAIN=A OR DOMAIN=BOR) (CATEGORY = U OR CATEGORY =W) (STATUS = P) 
| rename HOSTNAME as USERNAME
`wire` 
| fields AP USERNAME SEEN SITE ROOM COUNTRY
| eval USERNAME=upper(USERNAME) 
| eval LASTSEEN=strptime(SEEN, "%Y-%m-%d %H:%M:%S.%1N")  &lt;/LI-CODE&gt;</description>
    <pubDate>Sun, 15 Nov 2020 15:13:58 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2020-11-15T15:13:58Z</dc:date>
    <item>
      <title>Help on inputlookup with subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Help-on-inputlookup-with-subsearch/m-p/529434#M4156</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;Here is the beginning of my search&lt;/P&gt;&lt;P&gt;As you can see, I cross the USERNAME there is in my inputlookup with&amp;nbsp;`wire` macro&lt;/P&gt;&lt;P&gt;It works&lt;/P&gt;&lt;P&gt;But I woul be able to delete the last line&amp;nbsp;| lookup lookup_fo HOSTNAME as USERNAME output SITE ROOM COUNTRY because normaly all this fields are in my inputlookup?&lt;/P&gt;&lt;P&gt;But when I am doing this, I lose this fields&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do I am obliged to use this last line or how to do for being able to cross this ield with&amp;nbsp;`wire` macro?&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;[| inputlookup lookup_fo where TYPE="WW" (DOMAIN=A OR DOMAIN=BOR) (CATEGORY = U OR CATEGORY =W) (STATUS = P) 
    | table HOSTNAME 
    | rename HOSTNAME as USERNAME] `wire` 
| fields AP USERNAME SEEN 
| eval USERNAME=upper(USERNAME) 
| eval LASTSEEN=strptime(SEEN, "%Y-%m-%d %H:%M:%S.%1N")  
| lookup lookup_fo HOSTNAME as USERNAME output SITE ROOM COUNTRY &lt;/LI-CODE&gt;&lt;P&gt;&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, 15 Nov 2020 05:20:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Help-on-inputlookup-with-subsearch/m-p/529434#M4156</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2020-11-15T05:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: Help on inputlookup with subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Help-on-inputlookup-with-subsearch/m-p/529460#M4160</link>
      <description>&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;table HOSTNAME&lt;/FONT&gt; command discards all other fields so the last lookup is needed to retrieve them again.&lt;/P&gt;&lt;P&gt;Similarly, the fields command also discards all fields except AP, USERNAME, and SEEN so the final lookup is needed.&lt;/P&gt;&lt;P&gt;Why is the query starting with a subsearch?&amp;nbsp; A subsearch adds nothing in this case since it would execute first anyway.&lt;/P&gt;&lt;P&gt;What does the wire macro do?&lt;/P&gt;&lt;P&gt;See if this makes any difference&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup lookup_fo where TYPE="WW" (DOMAIN=A OR DOMAIN=BOR) (CATEGORY = U OR CATEGORY =W) (STATUS = P) 
| rename HOSTNAME as USERNAME
`wire` 
| fields AP USERNAME SEEN SITE ROOM COUNTRY
| eval USERNAME=upper(USERNAME) 
| eval LASTSEEN=strptime(SEEN, "%Y-%m-%d %H:%M:%S.%1N")  &lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 15 Nov 2020 15:13:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Help-on-inputlookup-with-subsearch/m-p/529460#M4160</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-11-15T15:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: Help on inputlookup with subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Help-on-inputlookup-with-subsearch/m-p/529463#M4161</link>
      <description>&lt;P&gt;Yes I know that | table HOSTNAME discards all other fields&lt;/P&gt;&lt;P&gt;And I would like to know if the final lookup was mandatory or not&lt;/P&gt;&lt;P&gt;If not, I need to find a way to retrieve this fields, reason why I have put this question&lt;/P&gt;&lt;P&gt;The macro is doing a matching between the USERNAME of the lookup and the USERNAME that exists in the macro index....&lt;/P&gt;&lt;P&gt;I dont know what you mean by "&lt;SPAN&gt;Why is the query starting with a subsearch?"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I need to cross the fields in the subsearch in order to be able to stats after....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;And concerning your code, of course it cant help because there is no matching between the macro and the lookup!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So my question is : is there a solution to retrieve the fields there is my lookup command ( SITE COUNTRY ROOM..) without using the lookup because thèse fields already exists in the inputlookup...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But if I am going | table HOSNAME SITE COUNTRY ROOM I can retrieve them in my stats command&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 15 Nov 2020 15:58:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Help-on-inputlookup-with-subsearch/m-p/529463#M4161</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2020-11-15T15:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: Help on inputlookup with subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Help-on-inputlookup-with-subsearch/m-p/529545#M4165</link>
      <description>&lt;P&gt;As I said in different words, the final lookup is required because the &lt;FONT face="courier new,courier"&gt;table&lt;/FONT&gt; command discarded the same fields that were returned by the first lookup.&amp;nbsp; If you eliminate the &lt;FONT face="courier new,courier"&gt;table&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;fields&lt;/FONT&gt; commands then the last lookup should not be necessary.&lt;/P&gt;&lt;P&gt;When SPL is enclosed within square brackets ([ ]) it is called a subsearch.&amp;nbsp; Subsearches execute first and their results become part of the main search.&amp;nbsp; Having a subsearch as the beginning of a query makes little sense because there's no change in execution order and there's no main search to which to add the subsearch's results.&lt;/P&gt;&lt;P&gt;I don't know what you mean by "cross the fields".&lt;/P&gt;&lt;P&gt;I didn't know what the macro does so I couldn't be sure if my suggested query would work with it, but the idea was to offer a different approach to problem.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 14:18:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Help-on-inputlookup-with-subsearch/m-p/529545#M4165</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-11-16T14:18:21Z</dc:date>
    </item>
  </channel>
</rss>

