<?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: Combining multiple tables by join in Splunk in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-tables-by-join-in-Splunk/m-p/193403#M55659</link>
    <description>&lt;P&gt;I think I may be looking at a MySQL database.  Some of the standard SQL commands give me errors and it even says things about MySQL.&lt;/P&gt;</description>
    <pubDate>Tue, 12 May 2015 17:50:51 GMT</pubDate>
    <dc:creator>dbrewerton</dc:creator>
    <dc:date>2015-05-12T17:50:51Z</dc:date>
    <item>
      <title>Combining multiple tables by join in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-tables-by-join-in-Splunk/m-p/193395#M55651</link>
      <description>&lt;P&gt;Hey folks, I am new here and glad to find this useful resource.  I have four tables that I am trying to create a join to make the information cohesive across all four.  My schema is like this:&lt;/P&gt;

&lt;P&gt;devmacs&lt;BR /&gt;
 - macaddr&lt;BR /&gt;
 - mac_id&lt;/P&gt;

&lt;P&gt;macport&lt;BR /&gt;
 - macportid&lt;BR /&gt;
 - portname&lt;/P&gt;

&lt;P&gt;devs&lt;BR /&gt;
 - officeid&lt;BR /&gt;
 - routername&lt;BR /&gt;
 - mac&lt;BR /&gt;
 - ip&lt;/P&gt;

&lt;P&gt;offices&lt;BR /&gt;
 - officeid&lt;BR /&gt;
 - officename&lt;/P&gt;

&lt;P&gt;Now, what I am trying to do is connect all of these up in the following ways:&lt;/P&gt;

&lt;P&gt;devmacs.mac_id joins to macport.macportid&lt;BR /&gt;
devmacs.mac joins to devs.mac&lt;BR /&gt;
devmacs.officeid joins to offices.officeid&lt;/P&gt;

&lt;P&gt;I want to present my table data like so:&lt;/P&gt;

&lt;P&gt;devmacs.macaddr, macport.portname, devs.routername, devs.ip, offices.officename&lt;/P&gt;

&lt;P&gt;If this were all SQL server query, I would probably have no trouble. The issue I have is getting used to how Splunk queries actually work using the dbconnect part of Splunk.  Any help would be most appreciated and thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2015 12:38:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-tables-by-join-in-Splunk/m-p/193395#M55651</guid>
      <dc:creator>dbrewerton</dc:creator>
      <dc:date>2015-05-12T12:38:04Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple tables by join in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-tables-by-join-in-Splunk/m-p/193396#M55652</link>
      <description>&lt;P&gt;You mention "tables" and "db connect".  Is your data in Splunk or in a SQL database?  If the latter then it's just a matter of creating an external database connection and using DB Connect to run a SQL query.&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2015 13:56:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-tables-by-join-in-Splunk/m-p/193396#M55652</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-05-12T13:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple tables by join in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-tables-by-join-in-Splunk/m-p/193397#M55653</link>
      <description>&lt;P&gt;Sorry, I was trying to establish a baseline of what my competency level is.  I heard that DB Connect is much like using SQL query language.&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2015 16:43:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-tables-by-join-in-Splunk/m-p/193397#M55653</guid>
      <dc:creator>dbrewerton</dc:creator>
      <dc:date>2015-05-12T16:43:11Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple tables by join in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-tables-by-join-in-Splunk/m-p/193398#M55654</link>
      <description>&lt;P&gt;Read this ! It may be the quickest way to get where you want to be: &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.3/SearchReference/SQLtoSplunk"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.3/SearchReference/SQLtoSplunk&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Secondly, if you post a few sample events, people will be able to help you much more easily. &lt;/P&gt;

&lt;P&gt;If those linked fields, e.g. office id, are very static, you may want to consider using a lookup table to connect these fields... If you did that, you'd be able to just use &lt;CODE&gt;table&lt;/CODE&gt; to get that output. &lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2015 16:51:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-tables-by-join-in-Splunk/m-p/193398#M55654</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-05-12T16:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple tables by join in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-tables-by-join-in-Splunk/m-p/193399#M55655</link>
      <description>&lt;P&gt;Give me the SQL and I will convert to SPL.&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2015 16:55:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-tables-by-join-in-Splunk/m-p/193399#M55655</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-05-12T16:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple tables by join in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-tables-by-join-in-Splunk/m-p/193400#M55656</link>
      <description>&lt;P&gt;Ok I think this should give me what I am looking for.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SELECT 
dm.macaddr, dm.mac_id, mp.macportid, mp.portname, 
dv.officeid, dv.routername, dv.mac, dv.ip,
off.officeid, off.officename from devmacs dm, macport mp, 
devs dv, offices off 
INNER JOIN macport on dv.mac_id = mp.macportid
INNER JOIN devmacs on dm.mac = dv.mac
INNER JOIN offices ON dv.officeid = off.officeid;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 May 2015 17:15:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-tables-by-join-in-Splunk/m-p/193400#M55656</guid>
      <dc:creator>dbrewerton</dc:creator>
      <dc:date>2015-05-12T17:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple tables by join in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-tables-by-join-in-Splunk/m-p/193401#M55657</link>
      <description>&lt;P&gt;If I understand you correctly, this is your situation:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype devmacs has fields {macaddr,mac_id}
sourceytpe macport has fields {macportid,portname}
sourcetype devs has fields {officeid,routername,mac,ip}
sourcetype offices has fields {officeid,officename}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If that is correct, then these are your base searches to do the "joins" (without using "join", which is problematic):&lt;BR /&gt;
&lt;CODE&gt;devmacs.mac_id joins to macport.macportid&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=devmacs OR sourcetype=macport | eval comboID=coalesce(devmacs,macport) | eventstats dc(sourcetype) AS sourcetypes by comboID | search sourcetypes&amp;amp;gt;=2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;CODE&gt;devmacs.mac joins to devs.mac&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sourcetype=devmacs OR sourcetype=devs | eventstats dc(sourcetype) AS sourcetypes by mac | search sourcetypes&amp;amp;gt;=2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;CODE&gt;devmacs.officeid joins to offices.officeid&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; sourcetype=devmacs OR sourcetype=officeid | eventstats dc(sourcetype) AS sourcetypes by officeid | search sourcetypes&amp;amp;gt;=2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As far as the rest, I do not understand what you are trying to do but this should get you almost there.&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2015 17:24:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-tables-by-join-in-Splunk/m-p/193401#M55657</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-05-12T17:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple tables by join in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-tables-by-join-in-Splunk/m-p/193402#M55658</link>
      <description>&lt;P&gt;DB Connect is used to extract data from an SQL database into Splunk.  Using DB Connect will feel familiar to SQL users.&lt;BR /&gt;
If your data is already in Splunk, however, DB Connect is not the answer.&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2015 17:47:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-tables-by-join-in-Splunk/m-p/193402#M55658</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-05-12T17:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple tables by join in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-tables-by-join-in-Splunk/m-p/193403#M55659</link>
      <description>&lt;P&gt;I think I may be looking at a MySQL database.  Some of the standard SQL commands give me errors and it even says things about MySQL.&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2015 17:50:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-tables-by-join-in-Splunk/m-p/193403#M55659</guid>
      <dc:creator>dbrewerton</dc:creator>
      <dc:date>2015-05-12T17:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple tables by join in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-tables-by-join-in-Splunk/m-p/193404#M55660</link>
      <description>&lt;P&gt;What are some of those commands, where are you entering them, and what are the errors?&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2015 17:54:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-tables-by-join-in-Splunk/m-p/193404#M55660</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-05-12T17:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple tables by join in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-tables-by-join-in-Splunk/m-p/193405#M55661</link>
      <description>&lt;P&gt;I was overthinking the situation.  Thank you folks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;  I did figure it out but each of you did help me on my adventure.&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2015 19:31:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-tables-by-join-in-Splunk/m-p/193405#M55661</guid>
      <dc:creator>dbrewerton</dc:creator>
      <dc:date>2015-05-12T19:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple tables by join in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-tables-by-join-in-Splunk/m-p/193406#M55662</link>
      <description>&lt;P&gt;Could you please share how you were able to do the task at hand. I am facing the similar issue, it would help me&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2018 12:08:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combining-multiple-tables-by-join-in-Splunk/m-p/193406#M55662</guid>
      <dc:creator>gangwarj</dc:creator>
      <dc:date>2018-02-05T12:08:38Z</dc:date>
    </item>
  </channel>
</rss>

