<?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: Splunk DB Connect 1: How to edit my search to compare a column from two databases and output anything that is different? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-Connect-1-How-to-edit-my-search-to-compare-a-column/m-p/129693#M184517</link>
    <description>&lt;P&gt;What you want is to discard those rows in &lt;EM&gt;softwareinventory&lt;/EM&gt; that are also present in &lt;EM&gt;authorisedsoftware&lt;/EM&gt;, leaving a list of unauthorised software.  I think this is a job for the join command.  This should get you started:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| dbquery "DATABASE" "SELECT FROM softwareinventory" | fields Application | dedup Application | join type=inner Application [ | dbquery "DATABASE" "SELECT FROM authorisedsoftware" | fields Application ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 28 May 2015 15:16:25 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2015-05-28T15:16:25Z</dc:date>
    <item>
      <title>Splunk DB Connect 1: How to edit my search to compare a column from two databases and output anything that is different?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-Connect-1-How-to-edit-my-search-to-compare-a-column/m-p/129692#M184516</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am working on a search string to extract a specific column named Applications from 2 databases&lt;/P&gt;

&lt;P&gt;I would then like to compare these 2 databases and output anything that is different&lt;/P&gt;

&lt;P&gt;This is to allow us to gather a list of un-approved software within the environment&lt;/P&gt;

&lt;P&gt;here is what I have so far&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| dbquery "DATABASE" "SELECT * FROM softwareinventory" | fields Application | dedup Application | appendcols [ | dbquery "DATABASE" "SELECT * FROM authorisedsoftware" | fields Application | rename Application to whitelist ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This returns all of the data, but I am unsure of how to compare the 2 columns and output those differences.&lt;/P&gt;

&lt;P&gt;thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 28 May 2015 13:55:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-Connect-1-How-to-edit-my-search-to-compare-a-column/m-p/129692#M184516</guid>
      <dc:creator>crossap</dc:creator>
      <dc:date>2015-05-28T13:55:57Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk DB Connect 1: How to edit my search to compare a column from two databases and output anything that is different?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-Connect-1-How-to-edit-my-search-to-compare-a-column/m-p/129693#M184517</link>
      <description>&lt;P&gt;What you want is to discard those rows in &lt;EM&gt;softwareinventory&lt;/EM&gt; that are also present in &lt;EM&gt;authorisedsoftware&lt;/EM&gt;, leaving a list of unauthorised software.  I think this is a job for the join command.  This should get you started:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| dbquery "DATABASE" "SELECT FROM softwareinventory" | fields Application | dedup Application | join type=inner Application [ | dbquery "DATABASE" "SELECT FROM authorisedsoftware" | fields Application ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 May 2015 15:16:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-Connect-1-How-to-edit-my-search-to-compare-a-column/m-p/129693#M184517</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-05-28T15:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk DB Connect 1: How to edit my search to compare a column from two databases and output anything that is different?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-Connect-1-How-to-edit-my-search-to-compare-a-column/m-p/129694#M184518</link>
      <description>&lt;P&gt;Hi Rich,&lt;/P&gt;

&lt;P&gt;Sadly this one doesn't seem to work.&lt;/P&gt;

&lt;P&gt;It displays items showing on my whitelist&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jun 2015 11:20:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-Connect-1-How-to-edit-my-search-to-compare-a-column/m-p/129694#M184518</guid>
      <dc:creator>crossap</dc:creator>
      <dc:date>2015-06-01T11:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk DB Connect 1: How to edit my search to compare a column from two databases and output anything that is different?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-Connect-1-How-to-edit-my-search-to-compare-a-column/m-p/129695#M184519</link>
      <description>&lt;P&gt;Try swapping the searches.  Put authorisedsoftware in the main search and softwareinventory in the subsearch.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jun 2015 11:37:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-Connect-1-How-to-edit-my-search-to-compare-a-column/m-p/129695#M184519</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-06-01T11:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk DB Connect 1: How to edit my search to compare a column from two databases and output anything that is different?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-Connect-1-How-to-edit-my-search-to-compare-a-column/m-p/129696#M184520</link>
      <description>&lt;P&gt;Hi Rich,&lt;/P&gt;

&lt;P&gt;sorry for slow reply I tried both ways and seem to get the same results its showing my authorisedlist each time as I can see applications that are allowed within our business.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jun 2015 12:36:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-Connect-1-How-to-edit-my-search-to-compare-a-column/m-p/129696#M184520</guid>
      <dc:creator>crossap</dc:creator>
      <dc:date>2015-06-02T12:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk DB Connect 1: How to edit my search to compare a column from two databases and output anything that is different?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-Connect-1-How-to-edit-my-search-to-compare-a-column/m-p/129697#M184521</link>
      <description>&lt;P&gt;Your experience appears to contradict the documentation that says "results of an inner join will not include&lt;BR /&gt;
any events from the main search with no matches".  Perhaps there's another way.  This is a bit more convoluted.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| dbquery "DATABASE" "SELECT FROM softwareinventory" | fields Application | dedup Application | [ | dbquery "DATABASE" "SELECT FROM authorisedsoftware" | outputlookup auth.csv ] | lookup auth.csv Application OUTPUT someColumnPresentOnlyInAuth | eval Auth=if (isnull(someColumnPresentOnlyInAuth), "NO","Yes") | where Auth="NO" | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jun 2015 12:46:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-Connect-1-How-to-edit-my-search-to-compare-a-column/m-p/129697#M184521</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-06-02T12:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk DB Connect 1: How to edit my search to compare a column from two databases and output anything that is different?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-Connect-1-How-to-edit-my-search-to-compare-a-column/m-p/129698#M184522</link>
      <description>&lt;P&gt;Try doing a "LEFT" join with left column being "softwareinventory" , have atleast two columns from "authorisedSoftware" table and  on final output compare whichever is NOT null.&lt;BR /&gt;
(The logic is, left side part would be your softwareinventory and anything which is not matched on right-hand side will output null values)&lt;/P&gt;

&lt;P&gt;Something like.. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| dbquery "DATABASE" "SELECT * FROM softwareinventory"  | fields Application| dedup Application  | join type=left Application  [ | dbquery "DATABASE" "SELECT * FROM authorisedsoftware" |  fields Application | dedup Application| eval DummyColumn="Table2"| fields Application, DummyColumn]  | search NOT DummyColumn=*
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jun 2015 13:46:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-Connect-1-How-to-edit-my-search-to-compare-a-column/m-p/129698#M184522</guid>
      <dc:creator>koshyk</dc:creator>
      <dc:date>2015-06-02T13:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk DB Connect 1: How to edit my search to compare a column from two databases and output anything that is different?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-Connect-1-How-to-edit-my-search-to-compare-a-column/m-p/129699#M184523</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Koshyk's answer got me close to my end result&lt;/P&gt;

&lt;P&gt;| dbquery "DATABASE" "SELECT * FROM softwareinventory" | fields Application | dedup Application | join type=left Application  [ | dbquery "DATABASE" "SELECT * FROM authorisedsoftware" | fields Application | stats count by Application | where count = 1 ] | where NOT count&amp;gt;0&lt;/P&gt;

&lt;P&gt;Anything that's on the white list receives a 1 count, I just then filtered out any that did not have a count &amp;gt;0&lt;/P&gt;

&lt;P&gt;thanks again Rich/Koshyk&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jun 2015 14:34:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-DB-Connect-1-How-to-edit-my-search-to-compare-a-column/m-p/129699#M184523</guid>
      <dc:creator>crossap</dc:creator>
      <dc:date>2015-06-02T14:34:01Z</dc:date>
    </item>
  </channel>
</rss>

