<?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 Best way to invoke python script that generates .csv files for lookup in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Best-way-to-invoke-python-script-that-generates-csv-files-for/m-p/72649#M14820</link>
    <description>&lt;P&gt;I have a python script that retrieves data from an external source and stores it in several .csv files.  I have added the necessary information to transforms.conf and savedsearches.conf to use the lookup function in the search to find the data mappings.  The .csv files are stored in the apps//lookups directory.  This is working as expected.
I plan to run the python program once per hour to refresh the data in the .csv files but I'm looking for the recommended way to do this.&lt;/P&gt;

&lt;P&gt;Questions: 
- What is the best way to run the script on a schedule?
- Is there a specific entry I should make in savedsearches.conf?  Should the script be placed in the apps//bin directory?
- Is it advisable to use inputs.conf, send the tables to stdout and have splunk index them directly?  (I really only want one copy of the data, it is not time-based)
- When performing the lookups, does splunk cache the .csv data?
- If the .csv file is updated on the fly, does splunk know to refresh it's internal representation?
- Is there a reduction in efficiency if the lookup tables grow very large?  I expect 10K-20K rows.&lt;/P&gt;</description>
    <pubDate>Fri, 01 Apr 2011 03:09:28 GMT</pubDate>
    <dc:creator>beaumaris</dc:creator>
    <dc:date>2011-04-01T03:09:28Z</dc:date>
    <item>
      <title>Best way to invoke python script that generates .csv files for lookup</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Best-way-to-invoke-python-script-that-generates-csv-files-for/m-p/72649#M14820</link>
      <description>&lt;P&gt;I have a python script that retrieves data from an external source and stores it in several .csv files.  I have added the necessary information to transforms.conf and savedsearches.conf to use the lookup function in the search to find the data mappings.  The .csv files are stored in the apps//lookups directory.  This is working as expected.
I plan to run the python program once per hour to refresh the data in the .csv files but I'm looking for the recommended way to do this.&lt;/P&gt;

&lt;P&gt;Questions: 
- What is the best way to run the script on a schedule?
- Is there a specific entry I should make in savedsearches.conf?  Should the script be placed in the apps//bin directory?
- Is it advisable to use inputs.conf, send the tables to stdout and have splunk index them directly?  (I really only want one copy of the data, it is not time-based)
- When performing the lookups, does splunk cache the .csv data?
- If the .csv file is updated on the fly, does splunk know to refresh it's internal representation?
- Is there a reduction in efficiency if the lookup tables grow very large?  I expect 10K-20K rows.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2011 03:09:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Best-way-to-invoke-python-script-that-generates-csv-files-for/m-p/72649#M14820</guid>
      <dc:creator>beaumaris</dc:creator>
      <dc:date>2011-04-01T03:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: Best way to invoke python script that generates .csv files for lookup</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Best-way-to-invoke-python-script-that-generates-csv-files-for/m-p/72650#M14821</link>
      <description>&lt;P&gt;beaumaris,&lt;/P&gt;

&lt;P&gt;I would recommend setting up a scripted inputs for this in inputs.conf like so:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;## inputs.conf
[script://$SPLUNK_HOME/etc/apps/&amp;lt;your_app_here&amp;gt;/bin/&amp;lt;your_script&amp;gt;.py]
disabled = false
## once per week on wednesday; using cron such that search doesn't execute @ start time
interval = 0 0 * * 3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For schedules, you can use an interval specified as # secs between executions, or a chron schedule.  I think the approach you are using to generate a .csv and use as a lookup w/in Splunk is the correct one.  I don't believe Splunk cache's the .csv data, so contents will be read from disk per invocation.  Updates to the .csv should take immediate affect in Splunk. 10k-20k rows should not be a problem.  There are considerations for distributed environments as the list will by default be replicated down to the indexers.  If the list is interacted w/ via "| lookup" instead of props.conf you can add the csv to distsearch.conf replication blacklist and use "| lookup local=true" which will make the lookup local to your search server.&lt;/P&gt;

&lt;P&gt;See also:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://www.splunk.com/base/Documentation/latest/Admin/Inputsconf" rel="nofollow"&gt;http://www.splunk.com/base/Documentation/latest/Admin/Inputsconf&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://www.splunk.com/base/Documentation/latest/Admin/Distsearchconf" rel="nofollow"&gt;http://www.splunk.com/base/Documentation/latest/Admin/Distsearchconf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2011 04:06:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Best-way-to-invoke-python-script-that-generates-csv-files-for/m-p/72650#M14821</guid>
      <dc:creator>hazekamp</dc:creator>
      <dc:date>2011-04-01T04:06:56Z</dc:date>
    </item>
  </channel>
</rss>

