<?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 How to compare 2 columns of a table when we use 'chart' command ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-2-columns-of-a-table-when-we-use-chart-command/m-p/503627#M140650</link>
    <description>&lt;P&gt;I have used the below query to create one table:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=abc sourcetype=xyz source=*.txt host=host1 OR host=host2
| rex field=source "/abcdef(?&amp;lt;EAR_Name&amp;gt;\w+.*ear)/versionInfo.txt"
| rex field=source "/xyzpqrs(?&amp;lt;EAR_Name&amp;gt;\w+.*ear)/versionInfo*.txt"
| rex field=_raw "deployTag=\d+\@\w+.*@(?&amp;lt;Label&amp;gt;\w+.*)" | chart latest(Label) by EAR_Name,host&lt;/LI-CODE&gt;
&lt;P&gt;My current table is,&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;EAR_Name&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;host1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; host2&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;mobile.ear&amp;nbsp; sg.mobile-12&amp;nbsp; &amp;nbsp;sg.mobile-10&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;google.ear&amp;nbsp; hk.google-45&amp;nbsp; &amp;nbsp;hk.google-45&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;facebook.ear&amp;nbsp; th.fb-37&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;th.fb-37&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;here..sg.mobile-12, hk.google-45 values of Label..&lt;/P&gt;
&lt;P&gt;My requirement is to compare(row-wise) each value of host1 column with host2 column..and produce the output like "Matching","Not Matching"...like below:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;EAR_Name&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;host1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;host2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Result&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;mobile.ear&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sg.mobile-12 sg.mobile-10 Not Matching&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;google.ear&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hk.google-45 hk.google-45 Matching&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;facebook.ear&amp;nbsp; &amp;nbsp; &amp;nbsp;th.fb-37&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; th.fb-37&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Matching&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jun 2020 19:59:51 GMT</pubDate>
    <dc:creator>georgear7</dc:creator>
    <dc:date>2020-06-10T19:59:51Z</dc:date>
    <item>
      <title>How to compare 2 columns of a table when we use 'chart' command ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-2-columns-of-a-table-when-we-use-chart-command/m-p/503627#M140650</link>
      <description>&lt;P&gt;I have used the below query to create one table:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=abc sourcetype=xyz source=*.txt host=host1 OR host=host2
| rex field=source "/abcdef(?&amp;lt;EAR_Name&amp;gt;\w+.*ear)/versionInfo.txt"
| rex field=source "/xyzpqrs(?&amp;lt;EAR_Name&amp;gt;\w+.*ear)/versionInfo*.txt"
| rex field=_raw "deployTag=\d+\@\w+.*@(?&amp;lt;Label&amp;gt;\w+.*)" | chart latest(Label) by EAR_Name,host&lt;/LI-CODE&gt;
&lt;P&gt;My current table is,&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;EAR_Name&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;host1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; host2&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;mobile.ear&amp;nbsp; sg.mobile-12&amp;nbsp; &amp;nbsp;sg.mobile-10&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;google.ear&amp;nbsp; hk.google-45&amp;nbsp; &amp;nbsp;hk.google-45&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;facebook.ear&amp;nbsp; th.fb-37&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;th.fb-37&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;here..sg.mobile-12, hk.google-45 values of Label..&lt;/P&gt;
&lt;P&gt;My requirement is to compare(row-wise) each value of host1 column with host2 column..and produce the output like "Matching","Not Matching"...like below:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;EAR_Name&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;host1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;host2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Result&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;mobile.ear&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sg.mobile-12 sg.mobile-10 Not Matching&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;google.ear&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hk.google-45 hk.google-45 Matching&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;facebook.ear&amp;nbsp; &amp;nbsp; &amp;nbsp;th.fb-37&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; th.fb-37&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Matching&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 19:59:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-2-columns-of-a-table-when-we-use-chart-command/m-p/503627#M140650</guid>
      <dc:creator>georgear7</dc:creator>
      <dc:date>2020-06-10T19:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 columns of a table when we use 'chart' command ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-2-columns-of-a-table-when-we-use-chart-command/m-p/503722#M140651</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;this will do it:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval Result=if(host1==host2,"Matching", "Not Matching")&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 10 Jun 2020 12:20:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-2-columns-of-a-table-when-we-use-chart-command/m-p/503722#M140651</guid>
      <dc:creator>rnowitzki</dc:creator>
      <dc:date>2020-06-10T12:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 columns of a table when we use 'chart' command ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-2-columns-of-a-table-when-we-use-chart-command/m-p/503831#M140660</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/64317"&gt;@rnowitzki&lt;/a&gt;&amp;nbsp;it's not working as expected. I got Result as "Non Matching" for all the rows even though identical values present for host1=host2.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 00:40:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-2-columns-of-a-table-when-we-use-chart-command/m-p/503831#M140660</guid>
      <dc:creator>georgear7</dc:creator>
      <dc:date>2020-06-11T00:40:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 columns of a table when we use 'chart' command ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-2-columns-of-a-table-when-we-use-chart-command/m-p/503912#M140676</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/40390"&gt;@skakehi_splunk&lt;/a&gt;, Can you help me here for this query ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 12:26:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-2-columns-of-a-table-when-we-use-chart-command/m-p/503912#M140676</guid>
      <dc:creator>georgear7</dc:creator>
      <dc:date>2020-06-11T12:26:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 columns of a table when we use 'chart' command ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-2-columns-of-a-table-when-we-use-chart-command/m-p/503974#M140695</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/63450"&gt;@georgear7&lt;/a&gt;&amp;nbsp; Looks like&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/64317"&gt;@rnowitzki&lt;/a&gt;&amp;nbsp;'s answer is the solution.&lt;/P&gt;&lt;P&gt;Did you try to add the solution to end of the line? (like this)&amp;nbsp;&lt;BR /&gt;If it doesn't work, let me know your SPL and sample results of Not Matching.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;index=abc sourcetype=xyz source=*.txt host=host1 OR host=host2
| rex field=source "/abcdef(?&amp;lt;EAR_Name&amp;gt;\w+.*ear)/versionInfo.txt"
| rex field=source "/xyzpqrs(?&amp;lt;EAR_Name&amp;gt;\w+.*ear)/versionInfo*.txt"
| rex field=_raw "deployTag=\d+\@\w+.*@(?&amp;lt;Label&amp;gt;\w+.*)"
| chart latest(Label) by EAR_Name,host
| eval Result=if(host1==host2,"Matching", "Not Matching")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;Just to be sure, check the result of the rex command on the third line you posted in your question.&amp;nbsp;&lt;BR /&gt;My concern is that the regular expression "versionInfo*.txt" is probably does not match filename such as "versionInfo20200611.txt".&amp;nbsp;&amp;nbsp;In this case, like "versionInfo.*.txt" or "versionInfo\d+.txt" works.&lt;BR /&gt;If the regular expression works correctly and extracts the information you want, you are good to go.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 17:49:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-2-columns-of-a-table-when-we-use-chart-command/m-p/503974#M140695</guid>
      <dc:creator>skakehi_splunk</dc:creator>
      <dc:date>2020-06-11T17:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 columns of a table when we use 'chart' command ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-2-columns-of-a-table-when-we-use-chart-command/m-p/504033#M140717</link>
      <description>&lt;P&gt;Thanks both&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/40390"&gt;@skakehi_splunk&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/64317"&gt;@rnowitzki&lt;/a&gt;&amp;nbsp;..My actual server name is something like below.&lt;/P&gt;&lt;P&gt;host-03u, host-04u..So when i used eval command, i forgot to put single quote in server name. So i didn't get the expected result.&lt;/P&gt;&lt;P&gt;Now after giving single quote in server name, it's working fine.&lt;/P&gt;&lt;P&gt;Thanks &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/40390"&gt;@skakehi_splunk&lt;/a&gt;&amp;nbsp;once again for your reply here..&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 02:29:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-2-columns-of-a-table-when-we-use-chart-command/m-p/504033#M140717</guid>
      <dc:creator>georgear7</dc:creator>
      <dc:date>2020-06-12T02:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 columns of a table when we use 'chart' command ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-2-columns-of-a-table-when-we-use-chart-command/m-p/563320#M196267</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/63450"&gt;@georgear7&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have you found solution for this scenario? If so, Kindly share it.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 15 Aug 2021 11:44:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-2-columns-of-a-table-when-we-use-chart-command/m-p/563320#M196267</guid>
      <dc:creator>Ashwini_5</dc:creator>
      <dc:date>2021-08-15T11:44:38Z</dc:date>
    </item>
  </channel>
</rss>

