<?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: Is there a way to APPEND events based on a field value from main search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-APPEND-events-based-on-a-field-value-from-main/m-p/248503#M74181</link>
    <description>&lt;P&gt;So if you want to append result of 2nd search to result of 1st search based on a field (common) from the result of 1st search, you need to use syntax like this. The append function doesn't offer any functionality to append conditionally. You have to use a subsearch in the 2nd search:&lt;BR /&gt;
&lt;STRONG&gt;Updated&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=my_index UserName=myuser | table _time UserName MacAddress Message 
| append [search index=my_index [search index=my_index UserName=myuser | stats count by MacAddress | table MacAddress ]| table _time UserName MacAddress Message]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 27 Jan 2016 03:09:14 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2016-01-27T03:09:14Z</dc:date>
    <item>
      <title>Is there a way to APPEND events based on a field value from main search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-APPEND-events-based-on-a-field-value-from-main/m-p/248498#M74176</link>
      <description>&lt;P&gt;I have a use case where a user will input a username and Splunk should return results for that username. But, there are seperate events related that username which do not contain the username field, but instead have the same mac address field. The following command is what I wish would work, but I know the append command doesn't allow you to pass data from the main search.&lt;/P&gt;

&lt;P&gt;index=my_index UserName=myuser | table _time UserName MacAddress Message | append MacAddress [search index=my_index | table _time UserName MacAddress Message]&lt;/P&gt;

&lt;P&gt;Does anybody know how I can acomplish this?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:33:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-APPEND-events-based-on-a-field-value-from-main/m-p/248498#M74176</guid>
      <dc:creator>jedatt01</dc:creator>
      <dc:date>2020-09-29T08:33:33Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to APPEND events based on a field value from main search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-APPEND-events-based-on-a-field-value-from-main/m-p/248499#M74177</link>
      <description>&lt;P&gt;Have you taken a look at the &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.2/SearchReference/Join"&gt;join command&lt;/A&gt;?&lt;BR /&gt;
Here's &lt;A href="http://blogs.splunk.com/2010/09/01/event-correlation/"&gt;a good blog post on event correlation&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2016 20:35:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-APPEND-events-based-on-a-field-value-from-main/m-p/248499#M74177</guid>
      <dc:creator>s2_splunk</dc:creator>
      <dc:date>2016-01-26T20:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to APPEND events based on a field value from main search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-APPEND-events-based-on-a-field-value-from-main/m-p/248500#M74178</link>
      <description>&lt;P&gt;You sample query says both the searches have a field called UserName, Is that a typo?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2016 20:39:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-APPEND-events-based-on-a-field-value-from-main/m-p/248500#M74178</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-01-26T20:39:22Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to APPEND events based on a field value from main search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-APPEND-events-based-on-a-field-value-from-main/m-p/248501#M74179</link>
      <description>&lt;P&gt;From what I understand the join command will join the fields of two events together. What I need to to be able to append the events but the append needs to be based on a common field&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2016 23:08:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-APPEND-events-based-on-a-field-value-from-main/m-p/248501#M74179</guid>
      <dc:creator>jedatt01</dc:creator>
      <dc:date>2016-01-26T23:08:39Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to APPEND events based on a field value from main search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-APPEND-events-based-on-a-field-value-from-main/m-p/248502#M74180</link>
      <description>&lt;P&gt;Does the MacAddress field exist in both events? If so "join" would work.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2016 02:04:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-APPEND-events-based-on-a-field-value-from-main/m-p/248502#M74180</guid>
      <dc:creator>kbecker</dc:creator>
      <dc:date>2016-01-27T02:04:54Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to APPEND events based on a field value from main search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-APPEND-events-based-on-a-field-value-from-main/m-p/248503#M74181</link>
      <description>&lt;P&gt;So if you want to append result of 2nd search to result of 1st search based on a field (common) from the result of 1st search, you need to use syntax like this. The append function doesn't offer any functionality to append conditionally. You have to use a subsearch in the 2nd search:&lt;BR /&gt;
&lt;STRONG&gt;Updated&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=my_index UserName=myuser | table _time UserName MacAddress Message 
| append [search index=my_index [search index=my_index UserName=myuser | stats count by MacAddress | table MacAddress ]| table _time UserName MacAddress Message]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Jan 2016 03:09:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-APPEND-events-based-on-a-field-value-from-main/m-p/248503#M74181</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-01-27T03:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to APPEND events based on a field value from main search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-APPEND-events-based-on-a-field-value-from-main/m-p/248504#M74182</link>
      <description>&lt;P&gt;Hi jedatt01&lt;BR /&gt;
Try this search code&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| set union [search index=my_index UserName=myuser| fields _time MacAddress Message] [search index=my_index NOT UserName| fields  _time MacAddress Message]|table _time MacAddress Message
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Jan 2016 11:04:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-APPEND-events-based-on-a-field-value-from-main/m-p/248504#M74182</guid>
      <dc:creator>chimell</dc:creator>
      <dc:date>2016-01-27T11:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to APPEND events based on a field value from main search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-APPEND-events-based-on-a-field-value-from-main/m-p/248505#M74183</link>
      <description>&lt;P&gt;This worked with one change in the syntax, Remove the MacAddress from after | append&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=my_index UserName=myuser | table _time UserName MacAddress Message 
 | append [search index=my_index [search index=my_index UserName=myuser | stats count by MacAddress | table MacAddress ]| table _time UserName MacAddress Message]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Jan 2016 13:23:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-APPEND-events-based-on-a-field-value-from-main/m-p/248505#M74183</guid>
      <dc:creator>jedatt01</dc:creator>
      <dc:date>2016-01-27T13:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to APPEND events based on a field value from main search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-APPEND-events-based-on-a-field-value-from-main/m-p/248506#M74184</link>
      <description>&lt;P&gt;Ohh.. cut copy paste error.  Updated the answer.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2016 01:54:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-APPEND-events-based-on-a-field-value-from-main/m-p/248506#M74184</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-01-28T01:54:40Z</dc:date>
    </item>
  </channel>
</rss>

