<?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: Compare values of 2 columns in a table in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Compare-values-of-2-columns-in-a-table/m-p/485751#M135916</link>
    <description>&lt;P&gt;Hi @ramonnegronvz &lt;BR /&gt;
my answer is updated. &lt;/P&gt;</description>
    <pubDate>Fri, 01 May 2020 22:49:55 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-05-01T22:49:55Z</dc:date>
    <item>
      <title>Compare values of 2 columns in a table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-values-of-2-columns-in-a-table/m-p/485746#M135911</link>
      <description>&lt;P&gt;I have a table that has &lt;STRONG&gt;2 columns&lt;/STRONG&gt; with Transaction ID's shown by a stats values() as below:&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;| stats values(E-TransactionID) as E-TransactionID values(R-TransactionID) as R-TransactionID&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;I'd like to compare the values of both columns and only show the Transaction ID's from &lt;STRONG&gt;R-TransactionID&lt;/STRONG&gt; that does &lt;STRONG&gt;NOT&lt;/STRONG&gt; appear in the &lt;STRONG&gt;E-TransactionID&lt;/STRONG&gt; column.&lt;/P&gt;

&lt;P&gt;I've made the following attempts after the stats values() with no luck. Any help is &lt;STRONG&gt;GREATLY&lt;/STRONG&gt; appreciated.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Attempt 1&lt;/STRONG&gt; (had to try this anyway):&lt;BR /&gt;
| table R-TransactionID E-TransactionID&lt;BR /&gt;
| where R-TransactionID != E-TransactionID&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Attempt 2&lt;/STRONG&gt;:&lt;BR /&gt;
| eval match=if(R-TransactionID=E-TransactionID, "EQUAL", R-TransactionID)&lt;BR /&gt;
| stats values(match) as TransactionID&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Attempt 3&lt;/STRONG&gt;:&lt;BR /&gt;
| foreach R-TransactionID &lt;BR /&gt;
    [eval match=if(R-TransactionID!=E-TransactionID, R-TransactionID, "MATCH")]&lt;BR /&gt;
| stats values(R-TransactionID) as R-TransactionID values(E-TransactionID) as E-TransactionID values(match) as TransactionID&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Attempt 4&lt;/STRONG&gt; (&lt;EM&gt;similar to previous, but with table instead&lt;/EM&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;BR /&gt;
| foreach R-TransactionID &lt;BR /&gt;
    [eval match=if(R-TransactionID!=E-TransactionID, R-TransactionID, "MATCH")]&lt;BR /&gt;
| stats values(R-TransactionID) as R-TransactionID values(E-TransactionID) as E-TransactionID values(match) as TransactionID&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2020 19:24:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-values-of-2-columns-in-a-table/m-p/485746#M135911</guid>
      <dc:creator>ramonnegronvz</dc:creator>
      <dc:date>2020-05-01T19:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: Compare values of 2 columns in a table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-values-of-2-columns-in-a-table/m-p/485747#M135912</link>
      <description>&lt;P&gt;One problem is the &lt;CODE&gt;values&lt;/CODE&gt; function returns a multi-value field which does not work well with other commands and functions.  Usually, &lt;CODE&gt;mvexpand&lt;/CODE&gt; helps, but you have two multi-value fields you're trying to match up.&lt;/P&gt;

&lt;P&gt;Perhaps you could take a step back and describe the original problem you want to solve.&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2020 20:12:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-values-of-2-columns-in-a-table/m-p/485747#M135912</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-05-01T20:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: Compare values of 2 columns in a table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-values-of-2-columns-in-a-table/m-p/485748#M135913</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt; &lt;BR /&gt;
Within the same index/sourcetype, there are 3 messages which I need to track in order to come up with the Transaction ID's that "matter". In the below query, I'm correlating 2 of the strings within the log events to come up with the E-TransactionID's (from the values of transid). I'm doing another search (string_3) to come up with R-TransactionID, which tells me about the Transaction ID's that "matter", but I want to "ignore" them if the Transaction ID matches E-TransactionID. In other words, my goal is to find the Transaction ID's that appear on R-TransactionID but NOT on E-TransactionID.&lt;/P&gt;

&lt;P&gt;From your comment, do you think if I change values to table, I'll be able to accomplish what I need?&lt;/P&gt;

&lt;P&gt;Here's a "dummy-down" search query I'm running to come up with both E-TransactionID and R-TransactionID:&lt;/P&gt;

&lt;P&gt;index=index_p sourcetype=st_p message="string_1"&lt;BR /&gt;
| join transid&lt;BR /&gt;
[ search index=index_p sourcetype=st_p message="string_2"&lt;BR /&gt;
| table transid]&lt;BR /&gt;
| stats values(transid) as E-TransactionID&lt;BR /&gt;
| append &lt;BR /&gt;
    [search index=index_p sourcetype=st_p message="string_2"&lt;BR /&gt;
    | stats values(transid) as R-TransactionID]&lt;BR /&gt;
| stats values(E-TransactionID) as E-TransactionID values(R-TransactionID) as R-TransactionID&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 05:11:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-values-of-2-columns-in-a-table/m-p/485748#M135913</guid>
      <dc:creator>ramonnegronvz</dc:creator>
      <dc:date>2020-09-30T05:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: Compare values of 2 columns in a table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-values-of-2-columns-in-a-table/m-p/485749#M135914</link>
      <description>&lt;P&gt;sample:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=20
| streamstats count
| stats values(count) as R
| eval E=split("1,4,6",",")
| eval tmp=mvsort(mvappend(E,R))
| stats count by tmp
| where count &amp;lt; 2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;try  &lt;CODE&gt;mvappend&lt;/CODE&gt; and &lt;CODE&gt;stats by&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;but,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=index_p sourcetype=st_p message="string_1" OR message="string_2"
| stats dc(message) as flag count(eval(message="string_1")) as message1  by  transid
| where flag &amp;lt; 2 AND message1 &amp;gt; 0
| table transid
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Your query does not need them.&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2020 21:49:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-values-of-2-columns-in-a-table/m-p/485749#M135914</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-05-01T21:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: Compare values of 2 columns in a table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-values-of-2-columns-in-a-table/m-p/485750#M135915</link>
      <description>&lt;P&gt;Thanks @to4kawa&lt;BR /&gt;
Let me see how can I attempt using mvappend and stats to fit my need here.&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2020 22:18:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-values-of-2-columns-in-a-table/m-p/485750#M135915</guid>
      <dc:creator>ramonnegronvz</dc:creator>
      <dc:date>2020-05-01T22:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: Compare values of 2 columns in a table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-values-of-2-columns-in-a-table/m-p/485751#M135916</link>
      <description>&lt;P&gt;Hi @ramonnegronvz &lt;BR /&gt;
my answer is updated. &lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2020 22:49:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-values-of-2-columns-in-a-table/m-p/485751#M135916</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-05-01T22:49:55Z</dc:date>
    </item>
    <item>
      <title>Re: Compare values of 2 columns in a table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-values-of-2-columns-in-a-table/m-p/485752#M135917</link>
      <description>&lt;P&gt;I must admit, that at the beginning I was trying to figure out how would this help, but after trying it out, and testing it out, it is perfect! Thanks so much @to4kawa!&lt;/P&gt;</description>
      <pubDate>Sun, 03 May 2020 22:27:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-values-of-2-columns-in-a-table/m-p/485752#M135917</guid>
      <dc:creator>ramonnegronvz</dc:creator>
      <dc:date>2020-05-03T22:27:52Z</dc:date>
    </item>
  </channel>
</rss>

