<?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: Python script with Universal forwarder in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Python-script-with-Universal-forwarder/m-p/102862#M21583</link>
    <description>&lt;P&gt;Sorry I forgot to mention here is inputs.conf&lt;/P&gt;

&lt;P&gt;[script://$SPLUNK_HOME\etc\system\bin\util.py &lt;A href="http://127.0.0.1:8085" target="_blank"&gt;http://127.0.0.1:8085&lt;/A&gt;]&lt;BR /&gt;
index = main&lt;BR /&gt;
interval = 30&lt;BR /&gt;
sourcetype = sys_health&lt;BR /&gt;
disabled = 0&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 14:24:35 GMT</pubDate>
    <dc:creator>jangid</dc:creator>
    <dc:date>2020-09-28T14:24:35Z</dc:date>
    <item>
      <title>Python script with Universal forwarder</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Python-script-with-Universal-forwarder/m-p/102860#M21581</link>
      <description>&lt;P&gt;Here is my script&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;from urllib2 import sys, Request, urlopen, URLError, HTTPError
if len(sys.argv) &amp;lt;= 1:
  sys.exit(0)
url = sys.argv[1] + "/messages=SplunkTestMessage&amp;amp;outputFormat=splunk"

req = Request(url)
try:
  response = urlopen(req)
except HTTPError, e:
  print "The server couldn\'t fulfill the request. ",
  print "error_code=", e.code, " status=2"
except URLError, e:
  print "Failed to reach server. ",
  print "error_code=", e.reason, " status=3"
else:
  html = response.read()
  print html, " status=1"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Same script perfectly works with Splunk main instance.&lt;/P&gt;

&lt;P&gt;How do I run python script with Universal forwarder?&lt;BR /&gt;
There is no problem with bat file and other exe. I am forwarding script output from Windows and AIX machine.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2013 15:54:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Python-script-with-Universal-forwarder/m-p/102860#M21581</guid>
      <dc:creator>jangid</dc:creator>
      <dc:date>2013-07-22T15:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: Python script with Universal forwarder</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Python-script-with-Universal-forwarder/m-p/102861#M21582</link>
      <description>&lt;P&gt;You can mention in the script stanza of inputs.conf file. But i am not sure how the script will run. For the script to execute it should have the compiler/interpreter. May be you need to set the script to run through python.&lt;/P&gt;

&lt;P&gt;See if the script runs manually, then try setting in script stanza OR Manually set the path and run through a bat file. Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2013 16:26:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Python-script-with-Universal-forwarder/m-p/102861#M21582</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2013-07-22T16:26:20Z</dc:date>
    </item>
    <item>
      <title>Re: Python script with Universal forwarder</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Python-script-with-Universal-forwarder/m-p/102862#M21583</link>
      <description>&lt;P&gt;Sorry I forgot to mention here is inputs.conf&lt;/P&gt;

&lt;P&gt;[script://$SPLUNK_HOME\etc\system\bin\util.py &lt;A href="http://127.0.0.1:8085" target="_blank"&gt;http://127.0.0.1:8085&lt;/A&gt;]&lt;BR /&gt;
index = main&lt;BR /&gt;
interval = 30&lt;BR /&gt;
sourcetype = sys_health&lt;BR /&gt;
disabled = 0&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:24:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Python-script-with-Universal-forwarder/m-p/102862#M21583</guid>
      <dc:creator>jangid</dc:creator>
      <dc:date>2020-09-28T14:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Python script with Universal forwarder</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Python-script-with-Universal-forwarder/m-p/102863#M21584</link>
      <description>&lt;P&gt;This script perfectly works manually and main splunk instance using it&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2013 16:53:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Python-script-with-Universal-forwarder/m-p/102863#M21584</guid>
      <dc:creator>jangid</dc:creator>
      <dc:date>2013-07-22T16:53:13Z</dc:date>
    </item>
    <item>
      <title>Re: Python script with Universal forwarder</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Python-script-with-Universal-forwarder/m-p/102864#M21585</link>
      <description>&lt;P&gt;Note that the Universal Forwarder does not include bundled Python:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0.3/Deploy/Introducingtheuniversalforwarder#Scripted_inputs_and_Python"&gt;Introducing the Universal Forwarder - Scripted inputs and Python&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;If you need to run a Python script on a Universal Forwarder, you can install a local version of Python and run the script by using a .bat file. Otherwise you will need to use a full version of Splunk configured as a Lightweight Forwarder.&lt;/P&gt;

&lt;P&gt;HTH,&lt;/P&gt;

&lt;P&gt;Dave&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2013 17:01:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Python-script-with-Universal-forwarder/m-p/102864#M21585</guid>
      <dc:creator>dshpritz</dc:creator>
      <dc:date>2013-07-22T17:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: Python script with Universal forwarder</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Python-script-with-Universal-forwarder/m-p/102865#M21586</link>
      <description>&lt;P&gt;bat file should contain the command then, include the bat file in the script stanza.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2013 17:23:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Python-script-with-Universal-forwarder/m-p/102865#M21586</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2013-07-22T17:23:39Z</dc:date>
    </item>
  </channel>
</rss>

