<?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 values from a subsearch using append in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Matching-values-from-a-subsearch-using-append/m-p/421361#M191040</link>
    <description>&lt;P&gt;I still required a field/column within my table stating Match or No Match.  In order to accomplish this, I ended up creating a lookup file &lt;/P&gt;

&lt;P&gt;lookup ProofOfConcept.CSV KEYFIELD as KEYFIELD OUTPUTNEW KEYFIELD as KEYFIELD2&lt;BR /&gt;
| eval results1=if(KEYFIELD=KEYFIELD2,"Match","No Match") &lt;/P&gt;

&lt;P&gt;When run over the last 24hrs I had both matches and no matches populate, which was to be expected.  &lt;/P&gt;</description>
    <pubDate>Fri, 02 Aug 2019 21:09:22 GMT</pubDate>
    <dc:creator>cquinney</dc:creator>
    <dc:date>2019-08-02T21:09:22Z</dc:date>
    <item>
      <title>Matching values from a subsearch using append</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-values-from-a-subsearch-using-append/m-p/421358#M191037</link>
      <description>&lt;P&gt;I'm having an issue with matching results between two searches utilizing the append command.  I realize I could use the join command but my goal is to create a new field labeled Match.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=type1 EVENT_TYPE=Blah1 KEYFIELD=*
| append
[search index=type2 EVENT_TYPE=Blah2
| eval KEYFIELD2=field1.field2.field3.field4
| fields KEYFIELD2]
| eval results1=if(KEYFIELD=KEYFIELD2,"Match","No Match") 
| eval results2=if(match(KEYFIELD ,KEYFIELD2),"Match","No Match") 
| eval results3=if(like(KEYFIELD ,"%".KEYFIELD2."%"), "Match","No Match") 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Even though I know there are "matches", my results only come back as No Match.&lt;BR /&gt;
Any assistance on this would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2019 18:20:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-values-from-a-subsearch-using-append/m-p/421358#M191037</guid>
      <dc:creator>cquinney</dc:creator>
      <dc:date>2019-08-01T18:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: Matching values from a subsearch using append</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-values-from-a-subsearch-using-append/m-p/421359#M191038</link>
      <description>&lt;P&gt;You are appending records, which doesn't put them side-by-side. So you will never have a record that has both KEYFIELD and KEYFIELD2 to compare to each other. You will need to use a stats command that correlates the two datasets. What happens if you try this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=type1 EVENT_TYPE=Blah1 KEYFIELD=*
| append
[search index=type2 EVENT_TYPE=Blah2
| eval KEYFIELD=field1.field2.field3.field4
| fields KEYFIELD, index]
| stats dc(index) as index_count by KEYFIELD
| sort -index_count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;There should be some values of KEYFIELD that have an index_count of 2 if there are matches. To filter them, add &lt;CODE&gt;|search index_count &amp;gt; 1&lt;/CODE&gt; to the search.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:34:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-values-from-a-subsearch-using-append/m-p/421359#M191038</guid>
      <dc:creator>grittonc</dc:creator>
      <dc:date>2020-09-30T01:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: Matching values from a subsearch using append</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-values-from-a-subsearch-using-append/m-p/421360#M191039</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=type1 EVENT_TYPE=Blah1 KEYFIELD=*) OR (index=type2 EVENT_TYPE=Blah2)
| eval KEYFIELD=coalesce(KEYFIELD, field1.field2.field3.field4)
| stats values(*) AS * dc(index) AS index_count BY KEYFIELD
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then add some combination of logic using &lt;CODE&gt;index=... AND/OR index_count=&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2019 03:51:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-values-from-a-subsearch-using-append/m-p/421360#M191039</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-08-02T03:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: Matching values from a subsearch using append</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-values-from-a-subsearch-using-append/m-p/421361#M191040</link>
      <description>&lt;P&gt;I still required a field/column within my table stating Match or No Match.  In order to accomplish this, I ended up creating a lookup file &lt;/P&gt;

&lt;P&gt;lookup ProofOfConcept.CSV KEYFIELD as KEYFIELD OUTPUTNEW KEYFIELD as KEYFIELD2&lt;BR /&gt;
| eval results1=if(KEYFIELD=KEYFIELD2,"Match","No Match") &lt;/P&gt;

&lt;P&gt;When run over the last 24hrs I had both matches and no matches populate, which was to be expected.  &lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2019 21:09:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-values-from-a-subsearch-using-append/m-p/421361#M191040</guid>
      <dc:creator>cquinney</dc:creator>
      <dc:date>2019-08-02T21:09:22Z</dc:date>
    </item>
  </channel>
</rss>

