<?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: best way ito index data from database in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/best-way-ito-index-data-from-database/m-p/34706#M393</link>
    <description>&lt;P&gt;Thanks!!!!&lt;BR /&gt;
One more thing I wonder about is the script itself..&lt;BR /&gt;
The script example I found is a script which saves the data to files..&lt;BR /&gt;
Is there an example for a python scripted input?..&lt;/P&gt;</description>
    <pubDate>Wed, 15 Aug 2012 05:39:14 GMT</pubDate>
    <dc:creator>reutc</dc:creator>
    <dc:date>2012-08-15T05:39:14Z</dc:date>
    <item>
      <title>best way ito index data from database</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/best-way-ito-index-data-from-database/m-p/34704#M391</link>
      <description>&lt;P&gt;Hey,&lt;BR /&gt;
I'm a little bit confused about the best way to index database data..&lt;BR /&gt;
 1. First way I found is building a python script which query the db and saves the&lt;BR /&gt;
 Data in files and then the indexing is just like regular logs..&lt;BR /&gt;
But should I save the files directly to the splunk server? In which format the files should be?&lt;BR /&gt;
Im not sure in which directory should I save the files .. and If splunk would save the data in the db directory like it does with the othdr data so it will be save twice on the server....&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Second thing is the lookups. Should I use this option? What is it for exactly?&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Thanks a lot!!&lt;/P&gt;</description>
      <pubDate>Tue, 14 Aug 2012 14:55:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/best-way-ito-index-data-from-database/m-p/34704#M391</guid>
      <dc:creator>reutc</dc:creator>
      <dc:date>2012-08-14T14:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: best way ito index data from database</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/best-way-ito-index-data-from-database/m-p/34705#M392</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Indexing data from a database:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;You could do as you have proposed and put the files anywhere you want, but you may have an easier time with a scripted input to splunk that splunk will run periodically and then dump all output into splunk directly. This way you do not have to deal with file management, check this out for more on the scripted input:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/4.3.3/Data/Setupcustominputs" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/4.3.3/Data/Setupcustominputs&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;If you just want access to the database data (and are using MySQL) you may want to look at the MySQL data connector, in either case it can be used as an example of how to build a data connector, though this is a big task. &lt;/P&gt;

&lt;P&gt;&lt;A href="http://splunk-base.splunk.com/apps/36664/splunk-mysql-connector" target="_blank"&gt;http://splunk-base.splunk.com/apps/36664/splunk-mysql-connector&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Using lookups:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Lookups are a very powerful tool in splunk. Essentially they are just csv files that you can either dynamically reference in searches or you can have splunk automatically use to augment your event data. The idea is that if you have some things that always mean something else you can have splunk "look up" the value. For example, if you have a log with a lot of DNS names in it you could have that log map to a lookup of DNS name to ip addresses. This way when you are searching you could enter either the ip or the DNS name and splunk would know to pull everything for you. &lt;/P&gt;

&lt;P&gt;The rule of thumb for lookups is that if you have a set of data that doesn't change often but that you need frequently you should use a lookup. In your case of a database it is possible that you may want some of your tables to be turned into lookups and NOT indexed. Say for example you had a table of users in your database that contained uid, username and email address. You would have your scripted input pull that data and instead of sending it to std out to be indexed have it update a csv file in your lookups directory in splunk. Then register that csv in transforms.conf as a lookup so that you can augment the data from your database automatically with user information. Take a look at this for more information:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Addfieldsfromexternaldatasources#Set_up_a_fields_lookup_based_on_a_static_file" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Addfieldsfromexternaldatasources#Set_up_a_fields_lookup_based_on_a_static_file&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Happy Splunking!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:16:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/best-way-ito-index-data-from-database/m-p/34705#M392</guid>
      <dc:creator>tfletcher_splun</dc:creator>
      <dc:date>2020-09-28T12:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: best way ito index data from database</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/best-way-ito-index-data-from-database/m-p/34706#M393</link>
      <description>&lt;P&gt;Thanks!!!!&lt;BR /&gt;
One more thing I wonder about is the script itself..&lt;BR /&gt;
The script example I found is a script which saves the data to files..&lt;BR /&gt;
Is there an example for a python scripted input?..&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 05:39:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/best-way-ito-index-data-from-database/m-p/34706#M393</guid>
      <dc:creator>reutc</dc:creator>
      <dc:date>2012-08-15T05:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: best way ito index data from database</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/best-way-ito-index-data-from-database/m-p/34707#M394</link>
      <description>&lt;P&gt;Never mind I understood that I just have to use the print &lt;BR /&gt;
 Command...&lt;BR /&gt;
But I want to use one script for many databases. Therefore I need to use the sys.argv inputs butwhen I insert to the command line of the scripted inputs variables the get an error message that the command line is not allowed? &lt;BR /&gt;
Any suggestions? ?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 06:24:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/best-way-ito-index-data-from-database/m-p/34707#M394</guid>
      <dc:creator>reutc</dc:creator>
      <dc:date>2012-08-15T06:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: best way ito index data from database</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/best-way-ito-index-data-from-database/m-p/34708#M395</link>
      <description>&lt;P&gt;Have a look at Ziegfried's new DBX app :&lt;/P&gt;

&lt;P&gt;&lt;A href="http://splunk-base.splunk.com/apps/50803/dbx-sql-database-extension"&gt;http://splunk-base.splunk.com/apps/50803/dbx-sql-database-extension&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 06:34:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/best-way-ito-index-data-from-database/m-p/34708#M395</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2012-08-15T06:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: best way ito index data from database</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/best-way-ito-index-data-from-database/m-p/34709#M396</link>
      <description>&lt;P&gt;Your answer is great..&lt;BR /&gt;
I want to use one script for many databases. Therefore I need to use the sys.argv inputs butwhen I insert to the command line of the scripted inputs variables the get an error message that the command line is not allowed? Any suggestions? ?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 06:39:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/best-way-ito-index-data-from-database/m-p/34709#M396</guid>
      <dc:creator>reutc</dc:creator>
      <dc:date>2012-08-15T06:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: best way ito index data from database</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/best-way-ito-index-data-from-database/m-p/34710#M397</link>
      <description>&lt;P&gt;So there's at least two ways to do that. &lt;BR /&gt;
Way 1:&lt;BR /&gt;
Specify the script multiple times in inputs.conf with different args, this way the same script will run against multiple db's in parallel. &lt;BR /&gt;
Way 2:&lt;BR /&gt;
Make a conf file for your script that your script periodically reads to get the database information then iterates across all databases. Note you can also print &lt;STRONG&gt;&lt;EM&gt;SPLUNK sourcetype=DB1&lt;/EM&gt;&lt;/STRONG&gt; to change sourcetypes, hosts and sources as you are printing to std out, should you want to assign a different sourcetype per db&lt;/P&gt;

&lt;P&gt;There are fancier ways to get this done, but this should get you started.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 17:38:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/best-way-ito-index-data-from-database/m-p/34710#M397</guid>
      <dc:creator>tfletcher_splun</dc:creator>
      <dc:date>2012-08-15T17:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: best way ito index data from database</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/best-way-ito-index-data-from-database/m-p/34711#M398</link>
      <description>&lt;P&gt;The examples I've seen specify only arguments like sourcetype, index ec'&lt;BR /&gt;
But what if I want simple arguments like the database connection data? Or to use sys.argv?&lt;/P&gt;</description>
      <pubDate>Fri, 17 Aug 2012 09:00:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/best-way-ito-index-data-from-database/m-p/34711#M398</guid>
      <dc:creator>reutc</dc:creator>
      <dc:date>2012-08-17T09:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: best way ito index data from database</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/best-way-ito-index-data-from-database/m-p/34712#M399</link>
      <description>&lt;P&gt;Just pass the args to the script in inputs.conf:&lt;/P&gt;

&lt;P&gt;[script://$SPLUNK_HOME/etc/apps/&lt;SCRIPTED_INPUT_NAME&gt;/bin/my_db_poll.sh -u username -p password -d db]&lt;BR /&gt;
disabled = true # change to false to start the input, requires restart&lt;BR /&gt;
host = # enter hostname here&lt;BR /&gt;
index = main&lt;BR /&gt;
interval = 30    #frequency to run the script&lt;BR /&gt;
source = my_db&lt;BR /&gt;
sourcetype = my_db_data&lt;/SCRIPTED_INPUT_NAME&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:17:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/best-way-ito-index-data-from-database/m-p/34712#M399</guid>
      <dc:creator>tfletcher_splun</dc:creator>
      <dc:date>2020-09-28T12:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: best way ito index data from database</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/best-way-ito-index-data-from-database/m-p/34713#M400</link>
      <description>&lt;P&gt;Its not working ..&lt;BR /&gt;
I've tried many formats... &lt;BR /&gt;
I'm trying just to check that it works.&lt;BR /&gt;
Im sending an argument which calls reut that contains string and trying to print this argument in the script. In addition I'm printing also sys.argv.&lt;BR /&gt;
I've tried these formats and nothing works:&lt;/P&gt;

&lt;P&gt;[Script://.\bin\nisui2.py reut="try"]&lt;/P&gt;

&lt;P&gt;[Script://.\bin\nisui2.py "try"]&lt;/P&gt;

&lt;P&gt;[Script://.\bin\nisui2.py -u try]&lt;/P&gt;

&lt;P&gt;[Script://.\bin\nisui2.py -u "try"]&lt;/P&gt;

&lt;P&gt;[Script://.\bin\nisui2.py -reut "try"]&lt;/P&gt;

&lt;P&gt;[Script://.\bin\nisui2.py -reut try]&lt;/P&gt;</description>
      <pubDate>Mon, 20 Aug 2012 09:16:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/best-way-ito-index-data-from-database/m-p/34713#M400</guid>
      <dc:creator>reutc</dc:creator>
      <dc:date>2012-08-20T09:16:39Z</dc:date>
    </item>
    <item>
      <title>Re: best way ito index data from database</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/best-way-ito-index-data-from-database/m-p/34714#M401</link>
      <description>&lt;P&gt;And of course there is a backslah before and after the bin directory..&lt;/P&gt;</description>
      <pubDate>Mon, 20 Aug 2012 09:20:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/best-way-ito-index-data-from-database/m-p/34714#M401</guid>
      <dc:creator>reutc</dc:creator>
      <dc:date>2012-08-20T09:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: best way ito index data from database</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/best-way-ito-index-data-from-database/m-p/34715#M402</link>
      <description>&lt;P&gt;You likely do not have the right syntax. Look at docs for inputs.conf:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/4.3.3/admin/Inputsconf"&gt;http://docs.splunk.com/Documentation/Splunk/4.3.3/admin/Inputsconf&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;There are special things in syntax if you are on windows. Be sure to read all of the docs. Then it is the same as passing args for any script you would run. Look at the nix app and the windows app depending on your platform for examples of how to do it.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Aug 2012 17:51:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/best-way-ito-index-data-from-database/m-p/34715#M402</guid>
      <dc:creator>tfletcher_splun</dc:creator>
      <dc:date>2012-08-20T17:51:10Z</dc:date>
    </item>
  </channel>
</rss>

