<?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: Comparing variables in a table in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Comparing-variables-in-a-table/m-p/310182#M93050</link>
    <description>&lt;P&gt;Can you provide some sample data from your rnddata.csv lookup?&lt;/P&gt;</description>
    <pubDate>Tue, 04 Apr 2017 20:06:02 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2017-04-04T20:06:02Z</dc:date>
    <item>
      <title>Comparing variables in a table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-variables-in-a-table/m-p/310181#M93049</link>
      <description>&lt;P&gt;I want to create a search that runs through a variable that contains many mac addresses that correspond to a specific store number, then compare it to another variable that has mac addresses that correspond to a specific store number from a different source but many of them should be identical. I want them to show up in rows that would like:&lt;/P&gt;

&lt;P&gt;Store #----SCCM Store #------Mac Address-----SCCM Mac Address&lt;BR /&gt;
1500----------1500-------------10:20:15:02:01-----10:20:15:02:01&lt;/P&gt;

&lt;P&gt;Likewise when it doesn't match&lt;/P&gt;

&lt;P&gt;Store #----SCCM Store #------Mac Address-----SCCM Mac Address&lt;BR /&gt;
1500----------1200-------------10:20:15:02:01-----10:20:15:02:01&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|inputlookup rnddata.csv |rename "Store #" as Store_Number|rename mac as Mac_Address 
| stats values(Mac_Address) as Mac_Address   values("SCCM Store") as "SCCM Store" by Store_Number SCCM_MAC_ADDRESS
| sort "SCCM Store" desc 
|table "SCCM Store" Store_Number Store_Desc Mac_Address SCCM_MAC_ADDRESS
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Right now when I do this without sccm data it works perfectly and will show me macs in a specific store_number but when trying the compare the numbers are all off&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2017 19:53:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-variables-in-a-table/m-p/310181#M93049</guid>
      <dc:creator>JoshuaJohn</dc:creator>
      <dc:date>2017-04-04T19:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing variables in a table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-variables-in-a-table/m-p/310182#M93050</link>
      <description>&lt;P&gt;Can you provide some sample data from your rnddata.csv lookup?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2017 20:06:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-variables-in-a-table/m-p/310182#M93050</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-04-04T20:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing variables in a table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-variables-in-a-table/m-p/310183#M93051</link>
      <description>&lt;P&gt;What is the format of each of your two data sources?  In other words, what fields are available from each of them?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2017 20:59:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-variables-in-a-table/m-p/310183#M93051</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-04-04T20:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing variables in a table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-variables-in-a-table/m-p/310184#M93052</link>
      <description>&lt;P&gt;I'm assuming you have two different data sources, which I've called  rnddata.csv  and sccmdata.csv.  I've assumed that the field names you are renaming in your code come from rnddata.csv, and that there are other field names to be renamed from the other file.  Fill in the field names and correct the file names as appropriate.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup rnddata.csv  
| rename "Store #" as StoreRND 
| rename mac as MacAddressRND  
| table StoreRND MacAddressRND 
| eval Store=StoreRND 
| eval MacAddress=MacAddressRND 
| append 
    [ | inputlookup sccmdata.csv 
    | rename xxxxx as StoreSCCM 
    | rename xxxxx as MacAddressSCCM 
    | table StoreSCCM MacAddressSCCM 
    | eval Store=StoreSCCM 
    | eval MacAddress=MacAddressSCCM ]
| eval type="detail"
| appendpipe 
    [| where type="detail" | stats values(*) as * by Store]
| appendpipe 
    [| where type="detail" | stats values(*) as * by MacAddress]
| where mvcount(Store)&amp;gt;1 OR mvcount(MacAddress)&amp;gt;1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will give you records for each mac that is assigned to multiple stores, and for each store that is assigned to multiple macs, and you'll be able to see which file contains which values.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2017 21:20:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-variables-in-a-table/m-p/310184#M93052</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-04-04T21:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing variables in a table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-variables-in-a-table/m-p/310185#M93053</link>
      <description>&lt;P&gt;&lt;IMG src="http://i.imgur.com/dCMebjq.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2017 21:21:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-variables-in-a-table/m-p/310185#M93053</guid>
      <dc:creator>JoshuaJohn</dc:creator>
      <dc:date>2017-04-04T21:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing variables in a table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-variables-in-a-table/m-p/310186#M93054</link>
      <description>&lt;P&gt;Its all one file, not two data sources that was my bad...need more caffeine&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2017 21:22:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-variables-in-a-table/m-p/310186#M93054</guid>
      <dc:creator>JoshuaJohn</dc:creator>
      <dc:date>2017-04-04T21:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing variables in a table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-variables-in-a-table/m-p/310187#M93055</link>
      <description>&lt;P&gt;This makes a single file of test data with a rectype (RND or SCCM) and values for store and mac...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval mydata="RND,1500,10:20:15:02:01 SCCM,1200,10:20:15:02:01 RND,1501,10:21:15:02:01 SCCM,1501,10:21:15:02:01 RND,1502,10:22:15:02:01 SCCM,1502,10:22:15:02:02 RND,1503,10:23:15:02:01 SCCM,1503,10:23:15:02:01" 
| makemv mydata | mvexpand mydata 
| rex field=mydata max_match=0 "(?&amp;lt;rectype&amp;gt;[^,\s]+),(?&amp;lt;store&amp;gt;[^,\s]+),(?&amp;lt;mac&amp;gt;[^,\s]+)"
| table rectype mac store 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This breaks it out into specific fields for what type of data it is &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval macfield="Mac".rectype 
| eval storefield="Store".rectype 
| eval {macfield}=mac 
| eval {storefield} = store 
| eval type="detail" 
| table mac store MacRND StoreRND MacSCCM StoreSCCM 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This produces consolidated records for each mac and for each store to determine if it has been connected with more than one of the other thing...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats values(*) as * by mac store 
| eval type ="detail" 
| appendpipe 
    [| where type="detail" | stats values(*) as * by store | eval type ="DupMacByStore"]  
| appendpipe 
    [| where type="detail" | stats values(*) as * by mac | eval type ="DupStoreByMac"] 
| where mvcount(store)&amp;gt;1 OR mvcount(mac) &amp;gt; 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;...resulting in this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;mac              store            MacRND           MacSCCM          StoreRND         StoreSCCM        type             

10:22:15:02:01   1502             10:22:15:02:01   10:22:15:02:02   1502             1502             DupMacByStore    
10:22:15:02:02                                                                                                         

10:20:15:02:01   1200             10:20:15:02:01   10:20:15:02:01   1500             1200             DupStoreByMac    
                 1500                                                                                                  
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Apr 2017 14:55:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-variables-in-a-table/m-p/310187#M93055</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-04-06T14:55:41Z</dc:date>
    </item>
  </channel>
</rss>

