<?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: How to compare columns in a row in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-columns-in-a-row/m-p/257720#M189548</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I've the answer now, but the source query was:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=beacons| spath | eval       temp=mvzip(mvzip(mvzip('bean.data.matches{}.clusterId','bean.data.matches{}.facility'),'bean.data.matches{}.matchStatus'), 'bean.data.matches{}.cluster') | mvexpand temp | eval x = split(temp,",") | eval clusterId=mvindex(x,0) | eval facility=mvindex(x,1) | eval match_status=mvindex(x,2) | eval cluster=mvindex(x,3) | search cluster=1 OR cluster=2 OR cluster=3 |  chart count by clusterId, facility
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 24 Mar 2016 10:40:29 GMT</pubDate>
    <dc:creator>ewanbrown</dc:creator>
    <dc:date>2016-03-24T10:40:29Z</dc:date>
    <item>
      <title>How to compare columns in a row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-columns-in-a-row/m-p/257716#M189544</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I have a query that produces some output like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ID server_a.1  server_a.2        server_b.1           server_b.2
1  0                   0            1                       0
2  1                   0            1                       1
3  1                   1            0                       0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'd like to be able to add to it to tell me the number of ID's which are present in server_a*, but not in server_b* and visa versa. I think I can do it by making this an inner query, however I need to do it across millions of records, so that is not an option&lt;/P&gt;

&lt;P&gt;Any help is appreciated!&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:10:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-columns-in-a-row/m-p/257716#M189544</guid>
      <dc:creator>ewanbrown</dc:creator>
      <dc:date>2020-09-29T09:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare columns in a row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-columns-in-a-row/m-p/257717#M189545</link>
      <description>&lt;P&gt;It would be helpful to see the search that produced this.&lt;BR /&gt;
I have a feeling that this table was produced by a chart command - but by using a stats command then xyseries, I think you can easily get what you want.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2016 20:22:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-columns-in-a-row/m-p/257717#M189545</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2016-03-23T20:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare columns in a row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-columns-in-a-row/m-p/257718#M189546</link>
      <description>&lt;P&gt;If the name of servers are fixed/static, then something like this could work&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search giving above output | addtotals server_a* fieldname=present_in_server_a | addtotals server_b* fieldname=present_in_server_b | eval status=case(present_in_server_a =0 AND present_in_server_b&amp;gt;0 ,"Present in server_b* only", present_in_server_a &amp;gt;0 AND present_in_server_b=0,"Present in server_a* only",1=1,"Present in both")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will add a field status to specify which ID is present in which servers. You can further chart the count if you need&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;above search | stats count by status
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Mar 2016 20:40:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-columns-in-a-row/m-p/257718#M189546</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-03-23T20:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare columns in a row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-columns-in-a-row/m-p/257719#M189547</link>
      <description>&lt;P&gt;Perfect, thanks&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 10:30:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-columns-in-a-row/m-p/257719#M189547</guid>
      <dc:creator>ewanbrown</dc:creator>
      <dc:date>2016-03-24T10:30:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare columns in a row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-columns-in-a-row/m-p/257720#M189548</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I've the answer now, but the source query was:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=beacons| spath | eval       temp=mvzip(mvzip(mvzip('bean.data.matches{}.clusterId','bean.data.matches{}.facility'),'bean.data.matches{}.matchStatus'), 'bean.data.matches{}.cluster') | mvexpand temp | eval x = split(temp,",") | eval clusterId=mvindex(x,0) | eval facility=mvindex(x,1) | eval match_status=mvindex(x,2) | eval cluster=mvindex(x,3) | search cluster=1 OR cluster=2 OR cluster=3 |  chart count by clusterId, facility
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 24 Mar 2016 10:40:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-columns-in-a-row/m-p/257720#M189548</guid>
      <dc:creator>ewanbrown</dc:creator>
      <dc:date>2016-03-24T10:40:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare columns in a row</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-columns-in-a-row/m-p/257721#M189549</link>
      <description>&lt;P&gt;Append this to your search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | foreach server_a* [eval A = A + &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;] | foreach server_b* [eval B = B + &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;] | multireport | [stats dc(ID) AS dcIDbyA values(ID) AS valuesIDbyA BY A] [stats dc(ID) as dcIDbyB values(ID) AS valuesIDbyB BY B]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 24 Mar 2016 14:28:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-columns-in-a-row/m-p/257721#M189549</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-03-24T14:28:44Z</dc:date>
    </item>
  </channel>
</rss>

