<?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: return a result from fields based on 2 queries in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/return-a-result-from-fields-based-on-2-queries/m-p/24666#M4578</link>
    <description>&lt;P&gt;Seems like a subsearch case. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;logger=Authentication [search IDS | fields IP]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or something similar. You can use the &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/format"&gt;format command&lt;/A&gt; to determine how you want the subsearch to concatenate its results for the main search.&lt;/P&gt;

&lt;P&gt;Update, using a map command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;first search | map search="search \"User Authentication\" IP=$dest_IP$" | fields username
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 11 Apr 2012 16:42:51 GMT</pubDate>
    <dc:creator>tysonstewart</dc:creator>
    <dc:date>2012-04-11T16:42:51Z</dc:date>
    <item>
      <title>return a result from fields based on 2 queries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/return-a-result-from-fields-based-on-2-queries/m-p/24665#M4577</link>
      <description>&lt;P&gt;I'm trying to return a field based upon a search and within that search extract a variable to search for in another search.  For example, I would like to get the username of the person who is authenticated on a computer in which an alert was triggered.  The IDS events come in, which display a destination IP address then I want to search for that IP address in the authentication logs, then return the username within the authentication log.  Any ideas?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2012 16:22:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/return-a-result-from-fields-based-on-2-queries/m-p/24665#M4577</guid>
      <dc:creator>gregwilliams</dc:creator>
      <dc:date>2012-04-11T16:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: return a result from fields based on 2 queries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/return-a-result-from-fields-based-on-2-queries/m-p/24666#M4578</link>
      <description>&lt;P&gt;Seems like a subsearch case. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;logger=Authentication [search IDS | fields IP]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or something similar. You can use the &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/format"&gt;format command&lt;/A&gt; to determine how you want the subsearch to concatenate its results for the main search.&lt;/P&gt;

&lt;P&gt;Update, using a map command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;first search | map search="search \"User Authentication\" IP=$dest_IP$" | fields username
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Apr 2012 16:42:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/return-a-result-from-fields-based-on-2-queries/m-p/24666#M4578</guid>
      <dc:creator>tysonstewart</dc:creator>
      <dc:date>2012-04-11T16:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: return a result from fields based on 2 queries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/return-a-result-from-fields-based-on-2-queries/m-p/24667#M4579</link>
      <description>&lt;P&gt;I get a "Encoutered an enexpected error while parsing intentions." error.  Here are the 2 logs I want to correlate:&lt;/P&gt;

&lt;P&gt;mm/dd-xx:xx:xx.xxxxx  ET TROJAN From CnC  [**] [Classification: A Network Trojan was detected] [Priority: 1] {TCP} xx.xx.xx.xx:xxxxx -&amp;gt; yy.yy.yy.yy:yyyy&lt;/P&gt;

&lt;P&gt;yy.yy.yy.yy is recognized as the dest_ip as a field&lt;/P&gt;

&lt;P&gt;and I want to correlate with this log:&lt;/P&gt;

&lt;P&gt;User Authentication Successful: username=zzzzzzz IP=yy.yy.yy.yy &lt;/P&gt;

&lt;P&gt;I want to correlate dest_ip and IP and return the username&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2012 16:57:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/return-a-result-from-fields-based-on-2-queries/m-p/24667#M4579</guid>
      <dc:creator>gregwilliams</dc:creator>
      <dc:date>2012-04-11T16:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: return a result from fields based on 2 queries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/return-a-result-from-fields-based-on-2-queries/m-p/24668#M4580</link>
      <description>&lt;P&gt;Oh, nice. You might be able to use a transaction to do that, depending on how many other events you expect to have with that IP. &lt;/P&gt;

&lt;P&gt;I'm going to guess you'll want to do this for more than one IP address, so it's probably better to go the map route:&lt;/P&gt;

&lt;P&gt;&lt;FIRST search=""&gt; | map search="\"User Authentication\" IP=$dest_IP$" | fields username&lt;/FIRST&gt;&lt;/P&gt;

&lt;P&gt;You can replace that "User Authentication" bit with whatever search will identify those types of events. The magic in map is the $variable$ part.&lt;/P&gt;

&lt;P&gt;Let me know if this works and I'll update the answer.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2012 17:08:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/return-a-result-from-fields-based-on-2-queries/m-p/24668#M4580</guid>
      <dc:creator>tysonstewart</dc:creator>
      <dc:date>2012-04-11T17:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: return a result from fields based on 2 queries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/return-a-result-from-fields-based-on-2-queries/m-p/24669#M4581</link>
      <description>&lt;P&gt;Works with a little tweaking.  I couldn't include the quotes into the mapped search, but I substituted that with the event ID of the authenticaiton string.  Works great!  &lt;/P&gt;

&lt;P&gt;"first search string" | map search="search xxxxxx IP=$dest_ip$" | fields username&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2012 17:47:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/return-a-result-from-fields-based-on-2-queries/m-p/24669#M4581</guid>
      <dc:creator>gregwilliams</dc:creator>
      <dc:date>2012-04-11T17:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: return a result from fields based on 2 queries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/return-a-result-from-fields-based-on-2-queries/m-p/24670#M4582</link>
      <description>&lt;P&gt;Yeah, I noticed that the splunkbase comment stripped the backslashes off those inner quotation marks. I'll update the original answer. Glad you got it working. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Oh, if you schedule that search, you'll need to save the map's search off as its own saved search (see &lt;A href="http://splunk-base.splunk.com/answers/27658/map-command-breaks-when-scheduled"&gt;http://splunk-base.splunk.com/answers/27658/map-command-breaks-when-scheduled&lt;/A&gt;).&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2012 18:14:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/return-a-result-from-fields-based-on-2-queries/m-p/24670#M4582</guid>
      <dc:creator>tysonstewart</dc:creator>
      <dc:date>2012-04-11T18:14:34Z</dc:date>
    </item>
  </channel>
</rss>

