<?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: Using Splunk DB Connect 1, how can I enrich my search results by inserting matching values from a MySQL database? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-Splunk-DB-Connect-1-how-can-I-enrich-my-search-results-by/m-p/203593#M187644</link>
    <description>&lt;P&gt;I've probably looked at that page 300 times over the last 2 days!&lt;/P&gt;

&lt;P&gt;I've created a 'database lookup' although I'm not sure sure I've done it correctly without an example, the documentation seems really light on information.&lt;/P&gt;

&lt;P&gt;The example query on the page you linked looks like this:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;index=test | lookup local=1 mysql_table ip_address as clientip OUTPUT host | table clientip, host&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;My best guess at interpreting that for my set up is:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;source="/var/log/audit/audit.log" | lookup myiplookup myhost as host OUTPUT myip | table myip, host &lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;(Where myiplookup is my 'database lookup', myhost is the hostname field in my database, myip is the ip field in my database, and host is the host field in my search results).&lt;/P&gt;

&lt;P&gt;A table is returned, but it's not inserting anything from the database (the search also returning 'error code 1').&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 07:41:53 GMT</pubDate>
    <dc:creator>joea9</dc:creator>
    <dc:date>2020-09-29T07:41:53Z</dc:date>
    <item>
      <title>Using Splunk DB Connect 1, how can I enrich my search results by inserting matching values from a MySQL database?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Splunk-DB-Connect-1-how-can-I-enrich-my-search-results-by/m-p/203591#M187642</link>
      <description>&lt;P&gt;I want to be able to enrich my Splunk search results using data in a MySQL database. &lt;BR /&gt;
Where the 'hostname' field in my Splunk search results matches the hostname field in my database, I want to insert the IP address from the database.&lt;/P&gt;

&lt;P&gt;So far I have set up the database connection within Splunk using DB Connect 1, and have returned the contents of my database using dbquery in the search bar.&lt;/P&gt;

&lt;P&gt;But how do I now create the database lookup that inserts the IP address into my search results when the hostname is found? &lt;/P&gt;

&lt;P&gt;&lt;EM&gt;(I've read all of the documentation but it isn't helping me to understand, I'd appreciate it if someone could provide an explanation with an example).&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2015 13:31:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Splunk-DB-Connect-1-how-can-I-enrich-my-search-results-by/m-p/203591#M187642</guid>
      <dc:creator>joea9</dc:creator>
      <dc:date>2015-10-22T13:31:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using Splunk DB Connect 1, how can I enrich my search results by inserting matching values from a MySQL database?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Splunk-DB-Connect-1-how-can-I-enrich-my-search-results-by/m-p/203592#M187643</link>
      <description>&lt;P&gt;It is all right here:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/DBX/1.2.2/DeployDBX/Setupadatabaselookuptable"&gt;http://docs.splunk.com/Documentation/DBX/1.2.2/DeployDBX/Setupadatabaselookuptable&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2015 14:09:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Splunk-DB-Connect-1-how-can-I-enrich-my-search-results-by/m-p/203592#M187643</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-10-22T14:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: Using Splunk DB Connect 1, how can I enrich my search results by inserting matching values from a MySQL database?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Splunk-DB-Connect-1-how-can-I-enrich-my-search-results-by/m-p/203593#M187644</link>
      <description>&lt;P&gt;I've probably looked at that page 300 times over the last 2 days!&lt;/P&gt;

&lt;P&gt;I've created a 'database lookup' although I'm not sure sure I've done it correctly without an example, the documentation seems really light on information.&lt;/P&gt;

&lt;P&gt;The example query on the page you linked looks like this:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;index=test | lookup local=1 mysql_table ip_address as clientip OUTPUT host | table clientip, host&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;My best guess at interpreting that for my set up is:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;source="/var/log/audit/audit.log" | lookup myiplookup myhost as host OUTPUT myip | table myip, host &lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;(Where myiplookup is my 'database lookup', myhost is the hostname field in my database, myip is the ip field in my database, and host is the host field in my search results).&lt;/P&gt;

&lt;P&gt;A table is returned, but it's not inserting anything from the database (the search also returning 'error code 1').&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:41:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Splunk-DB-Connect-1-how-can-I-enrich-my-search-results-by/m-p/203593#M187644</guid>
      <dc:creator>joea9</dc:creator>
      <dc:date>2020-09-29T07:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: Using Splunk DB Connect 1, how can I enrich my search results by inserting matching values from a MySQL database?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Splunk-DB-Connect-1-how-can-I-enrich-my-search-results-by/m-p/203594#M187645</link>
      <description>&lt;P&gt;I got this working...because I had a hard time finding any decent info regarding this, I'll explain what I had to do.&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Install DB connect&lt;/LI&gt;
&lt;LI&gt;Go to the Splunk DB Connect app in Splunk&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Go to "database connections in Splunk manager" --&amp;gt; New&lt;BR /&gt;
&lt;STRONG&gt;Database type&lt;/STRONG&gt; - choose the type of database you are using, you will need to find and install the relevant driver for your database if you don't have it already, but Splunk will give you all of the info you need to do this.&lt;BR /&gt;
&lt;STRONG&gt;Transaction  Isolation Level&lt;/STRONG&gt; - I had this set to 'DATABASE_SETTING'&lt;BR /&gt;
The rest of the options here are self explanatory, once you have saved that you should have an external database connection listed.&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;You should now be able to run a dbquery command to pull in data from your database:&lt;/P&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;| dbquery list "select * from myTable" &lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;In the above query, 'list' is the name of the database connection you've just set up&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;P&gt;Next you need to set up the Lookup so that data can be inserted from your database&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Go to Manager menu --&amp;gt; Database Lookups --&amp;gt; New&lt;BR /&gt;
&lt;STRONG&gt;Database&lt;/STRONG&gt; - The name of the database connection you just created will appear here&lt;BR /&gt;
&lt;STRONG&gt;Database Table&lt;/STRONG&gt; - The name of the table that you will be pulling data from&lt;BR /&gt;
&lt;STRONG&gt;Lookup Fields&lt;/STRONG&gt; - Choose all of the fields that you want to pull into Splunk, including the field you are matching on&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;You should now be able to run a lookup:&lt;/P&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;host="coffee" | lookup iplookup myhost as host OUTPUT myip, metadata | table host, myip, metadata&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;In the above query, 'lookup' just means that you're running a lookup query. iplookup is the name of my lookup in Manager--&amp;gt;Database lookup. myhost is the field in my database that I want to match with a field in my Splunk search results. I then want to OUTPUT the related fields from my database, in this case I want to enrich my results with the myip field and the metadata field. I then pipe the results into a table within Splunk, showing me the host, myip and metadata fields.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Oct 2015 14:22:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Splunk-DB-Connect-1-how-can-I-enrich-my-search-results-by/m-p/203594#M187645</guid>
      <dc:creator>joea9</dc:creator>
      <dc:date>2015-10-25T14:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using Splunk DB Connect 1, how can I enrich my search results by inserting matching values from a MySQL database?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Splunk-DB-Connect-1-how-can-I-enrich-my-search-results-by/m-p/203595#M187646</link>
      <description>&lt;P&gt;joea9,&lt;/P&gt;

&lt;P&gt;Nice write up, thanks for posting back what you found!  It really helps the community and people searching for answers a lot.  Why don't you accept your own answer to your question?  You answered it and deserve some karma!&lt;/P&gt;

&lt;P&gt;Thanks again.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2015 01:35:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Splunk-DB-Connect-1-how-can-I-enrich-my-search-results-by/m-p/203595#M187646</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2015-10-26T01:35:34Z</dc:date>
    </item>
  </channel>
</rss>

