<?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: subsearch not returning selected field values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/subsearch-not-returning-selected-field-values/m-p/353242#M104543</link>
    <description>&lt;P&gt;Hi scc00,&lt;BR /&gt;
try something like this&lt;/P&gt;

&lt;P&gt;index= user=xxx computer=vdi* &lt;BR /&gt;
| join user type=left [search sourcetype=something user=user1 event="logged" | fields user event ] &lt;BR /&gt;
| eval hostname=coalesce(computer, host) &lt;BR /&gt;
| table _time, user, hostname, event &lt;BR /&gt;
| sort 0 -_time&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 14:27:45 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2020-09-29T14:27:45Z</dc:date>
    <item>
      <title>subsearch not returning selected field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/subsearch-not-returning-selected-field-values/m-p/353241#M104542</link>
      <description>&lt;P&gt;I am trying to map a users activity once they've logged into a vdi session to when they log into a specific application. My search is as follows: I have tried using  the return, fields + and join commands to make this work. Each search returns values individually but together I get nothing. Thoughts?&lt;/P&gt;

&lt;P&gt;Searches:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Index=* user=xxx* computer=vdi* [search sourcetype=something user=user1 event=*"logged"* | fields + user, event] | eval hostname=coalesce(computer, host) | table _time, user, hostname, event |sort 0 -_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Index=* user=xxx* computer=vdi* [search sourcetype=something user=user1 event=*"logged"* | return 100 user, event] | eval hostname=coalesce(computer, host) | table _time, user, hostname, event |sort 0 -_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Index=* user=xxx* computer=vdi*| join user max=0 [search sourcetype=something user=user1 event=*"logged"* | fields + user, event] | eval hostname=coalesce(computer, host) | table _time, user, hostname, event |sort 0 -_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;updated to mark code&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 14:57:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/subsearch-not-returning-selected-field-values/m-p/353241#M104542</guid>
      <dc:creator>scc00</dc:creator>
      <dc:date>2017-06-14T14:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: subsearch not returning selected field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/subsearch-not-returning-selected-field-values/m-p/353242#M104543</link>
      <description>&lt;P&gt;Hi scc00,&lt;BR /&gt;
try something like this&lt;/P&gt;

&lt;P&gt;index= user=xxx computer=vdi* &lt;BR /&gt;
| join user type=left [search sourcetype=something user=user1 event="logged" | fields user event ] &lt;BR /&gt;
| eval hostname=coalesce(computer, host) &lt;BR /&gt;
| table _time, user, hostname, event &lt;BR /&gt;
| sort 0 -_time&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:27:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/subsearch-not-returning-selected-field-values/m-p/353242#M104543</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-09-29T14:27:45Z</dc:date>
    </item>
    <item>
      <title>Re: subsearch not returning selected field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/subsearch-not-returning-selected-field-values/m-p/353243#M104544</link>
      <description>&lt;P&gt;This is your first query.  The only thing I've changed is to switch from &lt;CODE&gt;fields&lt;/CODE&gt; to &lt;CODE&gt;table&lt;/CODE&gt; and then added &lt;CODE&gt;dedup&lt;/CODE&gt;.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* user=xxx* computer=vdi* 
    [ search sourcetype=something user=user1 event="*logged*" 
    | table user, event | dedup user, event] 
| eval hostname=coalesce(computer, host) 
| table _time, user, hostname, event 
| sort 0 - _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The &lt;CODE&gt;table&lt;/CODE&gt; command eliminates all fields except the ones listed, whereas the &lt;CODE&gt;fields&lt;/CODE&gt; command leaves some internal fields like &lt;CODE&gt;_time&lt;/CODE&gt;, which after it goes through the implicit &lt;CODE&gt;format&lt;/CODE&gt; command at the end of the subsearch (when it hits the close bracket &lt;CODE&gt;]&lt;/CODE&gt;), is going to mess with retrieving the records .&lt;/P&gt;

&lt;P&gt;To see the difference, compare the output of these -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    sourcetype=something user=user1 event="*logged*" 
    | fields + user, event 
    | format 

    sourcetype=something user=user1 event="*logged*" 
    | table user, event 
    | format 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;Updated to include the asterisks that the interface had removed from OP's search&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 15:57:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/subsearch-not-returning-selected-field-values/m-p/353243#M104544</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-06-14T15:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: subsearch not returning selected field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/subsearch-not-returning-selected-field-values/m-p/353244#M104545</link>
      <description>&lt;P&gt;Thanks Giuseppe, so this only gives me one side of the data. I am trying to link user logins to user application activity. I am having some trouble bringing the two pieces together. Any thoughts around the best method to link the user login with the user application login? &lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 18:34:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/subsearch-not-returning-selected-field-values/m-p/353244#M104545</guid>
      <dc:creator>scc00</dc:creator>
      <dc:date>2017-06-14T18:34:54Z</dc:date>
    </item>
    <item>
      <title>Re: subsearch not returning selected field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/subsearch-not-returning-selected-field-values/m-p/353245#M104546</link>
      <description>&lt;P&gt;Unfortunately, neither of these suggestion worked. I am trying to link user logins to user application activity. I am having some trouble bringing the two pieces together. Any thoughts around the best method to link the user login with the user application login? assuming the VDI login ID for the user may differ from the application user ID?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 18:39:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/subsearch-not-returning-selected-field-values/m-p/353245#M104546</guid>
      <dc:creator>scc00</dc:creator>
      <dc:date>2017-06-14T18:39:59Z</dc:date>
    </item>
    <item>
      <title>Re: subsearch not returning selected field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/subsearch-not-returning-selected-field-values/m-p/353246#M104547</link>
      <description>&lt;P&gt;Okay, I marked your code as code, so the asterisks showed up.  I updated my code to include them. &lt;/P&gt;

&lt;P&gt;"Did not work" doesn't give us anything to go on.  Please be very specific about what does or does not occur.   Did the last two samples produce any results?  Did the difference make sense to you?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 02:07:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/subsearch-not-returning-selected-field-values/m-p/353246#M104547</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-06-15T02:07:36Z</dc:date>
    </item>
    <item>
      <title>Re: subsearch not returning selected field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/subsearch-not-returning-selected-field-values/m-p/353247#M104548</link>
      <description>&lt;P&gt;My apologies. I meant the searches came back empty when I run each option you mentioned. If i separate the subsearch from the main search, it returns values but not together.&lt;/P&gt;

&lt;P&gt;index=* user=xxx* computer=vdi* [ search sourcetype=something user=user1 event="&lt;EM&gt;logged&lt;/EM&gt;" &lt;BR /&gt;
     | table user, event | dedup user, event] | eval hostname=coalesce(computer, host) &lt;BR /&gt;
 | table _time, user, hostname, event &lt;BR /&gt;
 | sort 0 - _time&lt;/P&gt;

&lt;P&gt;OR &lt;BR /&gt;
index=* user=xxx* computer=vdi* [ search sourcetype=something user=user1 event="&lt;EM&gt;logged&lt;/EM&gt;" &lt;BR /&gt;
     | fields+ user, event | dedup user, event] | eval hostname=coalesce(computer, host) &lt;BR /&gt;
 | table _time, user, hostname, event &lt;BR /&gt;
 | sort 0 - _time&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 13:02:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/subsearch-not-returning-selected-field-values/m-p/353247#M104548</guid>
      <dc:creator>scc00</dc:creator>
      <dc:date>2017-06-15T13:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: subsearch not returning selected field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/subsearch-not-returning-selected-field-values/m-p/353248#M104549</link>
      <description>&lt;P&gt;Additionally, when I use the join command shown below it only gives me the main search. I need it to do a comparison between the user in the subsearch and pull only corresponding  results from the main search specific to that users activities. Sometimes the user may be different from the user within the subsearch. &lt;/P&gt;

&lt;P&gt;index=* user=xxx* computer=vdi* | join user type=left [ search sourcetype=something user=user1 event="&lt;EM&gt;logged&lt;/EM&gt;" &lt;BR /&gt;
     | table user, event | dedup user, event] | eval hostname=coalesce(computer, host) &lt;BR /&gt;
 | table _time, user, hostname, event &lt;BR /&gt;
 | sort 0 - _time&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 13:04:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/subsearch-not-returning-selected-field-values/m-p/353248#M104549</guid>
      <dc:creator>scc00</dc:creator>
      <dc:date>2017-06-15T13:04:41Z</dc:date>
    </item>
  </channel>
</rss>

