<?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: How to set python script to run automatically on a  custom app. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-set-python-script-to-run-automatically-on-a-custom-app/m-p/452678#M128176</link>
    <description>&lt;P&gt;Can we have some python script which will create inputs.conf stanza by pulling log file location from word\csv file.&lt;BR /&gt;
Note- Index will be same for all , only sourcetype will be changed which will be name of log file.&lt;/P&gt;</description>
    <pubDate>Sat, 29 Sep 2018 08:42:20 GMT</pubDate>
    <dc:creator>ashikuma</dc:creator>
    <dc:date>2018-09-29T08:42:20Z</dc:date>
    <item>
      <title>How to set python script to run automatically on a  custom app.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-set-python-script-to-run-automatically-on-a-custom-app/m-p/452670#M128168</link>
      <description>&lt;P&gt;Hello guys, I am new to Splunk. I need help in letting the python script i have created to run automatically every month. My python script is able to get API JSON output and create a lookup file or update existing one. Now i need it to run it automatically in the APPS/bin folder i have already configured the inputs.conf file but the script is not or creating the csv lookup file!&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 08:27:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-set-python-script-to-run-automatically-on-a-custom-app/m-p/452670#M128168</guid>
      <dc:creator>splunkbot22</dc:creator>
      <dc:date>2018-07-20T08:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to set python script to run automatically on a  custom app.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-set-python-script-to-run-automatically-on-a-custom-app/m-p/452671#M128169</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Please paste here  your inputs.conf and the location of python file.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 10:10:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-set-python-script-to-run-automatically-on-a-custom-app/m-p/452671#M128169</guid>
      <dc:creator>thambisetty</dc:creator>
      <dc:date>2018-07-20T10:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to set python script to run automatically on a  custom app.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-set-python-script-to-run-automatically-on-a-custom-app/m-p/452672#M128170</link>
      <description>&lt;P&gt;Hi, splunkbot22.&lt;/P&gt;

&lt;P&gt;you can use the interval property with the crontab syntax:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;interval = [&amp;lt;number&amp;gt;|&amp;lt;cron schedule&amp;gt;]&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Ex:&lt;BR /&gt;
&lt;CODE&gt;[script:// ./bin/script_name ]&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;interval = 30 12 * */12 * #[ At 12:30 in every 12th month. ]&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;index = index_name&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;source = source_name&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;sourcetype = sourcetype_name&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;As for the output of the script, you do not need to generate a csv, just make an impression of the data in the standard output that Splunk will collect this data.&lt;/P&gt;

&lt;P&gt;If you have any questions about the syntax of crontab, you can use this site as a reference: &lt;A href="https://crontab.guru/#30_12_*_*/12_*"&gt;Crontab.guru&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 14:08:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-set-python-script-to-run-automatically-on-a-custom-app/m-p/452672#M128170</guid>
      <dc:creator>markuxProof</dc:creator>
      <dc:date>2018-07-20T14:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to set python script to run automatically on a  custom app.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-set-python-script-to-run-automatically-on-a-custom-app/m-p/452673#M128171</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;Thank you for the reply, i have already add the script and interval properties in the inputs.conf under the default directory on my app. However can you further elaborate how do i make an impression of the data in the standard output? Or append he api response into the csv file?&lt;/P&gt;</description>
      <pubDate>Sun, 22 Jul 2018 12:44:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-set-python-script-to-run-automatically-on-a-custom-app/m-p/452673#M128171</guid>
      <dc:creator>splunkbot22</dc:creator>
      <dc:date>2018-07-22T12:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to set python script to run automatically on a  custom app.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-set-python-script-to-run-automatically-on-a-custom-app/m-p/452674#M128172</link>
      <description>&lt;P&gt;Hi, &lt;BR /&gt;
the location of my python file is under /app/bin and the location of the inputs.conf file is in the /apps/default directory of my app .&lt;/P&gt;

&lt;P&gt;Content of my inputs.conf is &lt;BR /&gt;
[script://opt/splunk/etc/apps/School/bin/retreivefromthreatcrowd.py]&lt;BR /&gt;
interval=60&lt;BR /&gt;
disabled=false&lt;BR /&gt;
source=script://./bin/retreivefromthreadcrowd.py&lt;/P&gt;</description>
      <pubDate>Sun, 22 Jul 2018 12:48:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-set-python-script-to-run-automatically-on-a-custom-app/m-p/452674#M128172</guid>
      <dc:creator>splunkbot22</dc:creator>
      <dc:date>2018-07-22T12:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to set python script to run automatically on a  custom app.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-set-python-script-to-run-automatically-on-a-custom-app/m-p/452675#M128173</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
Thanks for the reply, I had already set the interval crontab syntax in the inputs.conf file. However can you elaborate more how i can make an impression of the data? And how i can update the existing lookups file with it?&lt;/P&gt;</description>
      <pubDate>Sun, 22 Jul 2018 12:50:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-set-python-script-to-run-automatically-on-a-custom-app/m-p/452675#M128173</guid>
      <dc:creator>splunkbot22</dc:creator>
      <dc:date>2018-07-22T12:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to set python script to run automatically on a  custom app.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-set-python-script-to-run-automatically-on-a-custom-app/m-p/452676#M128174</link>
      <description>&lt;P&gt;You can create a modular input:&lt;BR /&gt;
&lt;A href="http://dev.splunk.com/view/python-sdk/SP-CAAAER3"&gt;http://dev.splunk.com/view/python-sdk/SP-CAAAER3&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Or you can make your script write the csv to a location that you also monitor in inputs.conf.&lt;/P&gt;</description>
      <pubDate>Sun, 22 Jul 2018 18:04:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-set-python-script-to-run-automatically-on-a-custom-app/m-p/452676#M128174</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2018-07-22T18:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to set python script to run automatically on a  custom app.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-set-python-script-to-run-automatically-on-a-custom-app/m-p/452677#M128175</link>
      <description>&lt;P&gt;Scripted inputs will index everything on stdout from the execution of the script.&lt;/P&gt;

&lt;P&gt;So you could just print your csv to the screen&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import csv
with open('eggs.csv', 'rb') as csvfile:
      Reader = csv.reader(csvfile, delimiter=',', quote-char='”’)
      for row in Reader:
            print(row)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 22 Jul 2018 18:10:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-set-python-script-to-run-automatically-on-a-custom-app/m-p/452677#M128175</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2018-07-22T18:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to set python script to run automatically on a  custom app.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-set-python-script-to-run-automatically-on-a-custom-app/m-p/452678#M128176</link>
      <description>&lt;P&gt;Can we have some python script which will create inputs.conf stanza by pulling log file location from word\csv file.&lt;BR /&gt;
Note- Index will be same for all , only sourcetype will be changed which will be name of log file.&lt;/P&gt;</description>
      <pubDate>Sat, 29 Sep 2018 08:42:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-set-python-script-to-run-automatically-on-a-custom-app/m-p/452678#M128176</guid>
      <dc:creator>ashikuma</dc:creator>
      <dc:date>2018-09-29T08:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to set python script to run automatically on a  custom app.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-set-python-script-to-run-automatically-on-a-custom-app/m-p/452679#M128177</link>
      <description>&lt;P&gt;Yes you can do many things with python.&lt;/P&gt;</description>
      <pubDate>Sun, 30 Sep 2018 00:40:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-set-python-script-to-run-automatically-on-a-custom-app/m-p/452679#M128177</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2018-09-30T00:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to set python script to run automatically on a  custom app.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-set-python-script-to-run-automatically-on-a-custom-app/m-p/452680#M128178</link>
      <description>&lt;P&gt;Makes perfect sense @ashikuma.&lt;/P&gt;

&lt;P&gt;For example, I use a python a base script like this to build pieces of my ever changing &lt;CODE&gt;serverclass.conf&lt;/CODE&gt; -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import sys


input_file       = "&amp;lt;location&amp;gt;/&amp;lt;file&amp;gt;.txt"

i = 0
f = open(input_file)
for line in f:
    # strip the new line character
    line = line[:-1]
    parts = line.split("$")


    print 'whitelist.' + str(i) + ' = ' + line + '&amp;lt;domain&amp;gt;'
    i = i + 1


f.close()
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 30 Sep 2018 00:40:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-set-python-script-to-run-automatically-on-a-custom-app/m-p/452680#M128178</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2018-09-30T00:40:26Z</dc:date>
    </item>
  </channel>
</rss>

