<?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 do I capture the output of a script from a scripted input? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-capture-the-output-of-a-script-from-a-scripted-input/m-p/414970#M73370</link>
    <description>&lt;P&gt;Interestingly enough not picking up anything from a print either. &lt;/P&gt;</description>
    <pubDate>Fri, 12 Apr 2019 19:30:25 GMT</pubDate>
    <dc:creator>daniel333</dc:creator>
    <dc:date>2019-04-12T19:30:25Z</dc:date>
    <item>
      <title>How do I capture the output of a script from a scripted input?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-capture-the-output-of-a-script-from-a-scripted-input/m-p/414968#M73368</link>
      <description>&lt;P&gt;All, &lt;/P&gt;

&lt;P&gt;I have a script which I'd like to capture the output from. I assumed that as long as I had it started by my splunkforwarder with an interval=0 it would run for ever and capture anything the script generates. But doesn't appear so. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[script://./bin/spidertrap.py]
  interval = 0
  index = main
  sourcetype = spidertrap
  source = spidertrap.py
  disabled = 0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The script source can be found here - &lt;BR /&gt;
&lt;A href="https://github.com/omarkhan/spidertrap/blob/master/spidertrap.py"&gt;https://github.com/omarkhan/spidertrap/blob/master/spidertrap.py&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I've verified that Splunk is running the script. If I run the script directly I get output to the console I expect. &lt;/P&gt;

&lt;P&gt;Any ideas? &lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 18:56:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-capture-the-output-of-a-script-from-a-scripted-input/m-p/414968#M73368</guid>
      <dc:creator>daniel333</dc:creator>
      <dc:date>2019-04-12T18:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do I capture the output of a script from a scripted input?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-capture-the-output-of-a-script-from-a-scripted-input/m-p/414969#M73369</link>
      <description>&lt;P&gt;Try to use &lt;CODE&gt;print&lt;/CODE&gt; function to print your data to stdout which Splunk reads. See this for reference. &lt;A href="https://sublimerobots.com/2017/01/simple-splunk-scripted-input-example/"&gt;https://sublimerobots.com/2017/01/simple-splunk-scripted-input-example/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 19:13:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-capture-the-output-of-a-script-from-a-scripted-input/m-p/414969#M73369</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-04-12T19:13:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do I capture the output of a script from a scripted input?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-capture-the-output-of-a-script-from-a-scripted-input/m-p/414970#M73370</link>
      <description>&lt;P&gt;Interestingly enough not picking up anything from a print either. &lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 19:30:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-capture-the-output-of-a-script-from-a-scripted-input/m-p/414970#M73370</guid>
      <dc:creator>daniel333</dc:creator>
      <dc:date>2019-04-12T19:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do I capture the output of a script from a scripted input?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-capture-the-output-of-a-script-from-a-scripted-input/m-p/414971#M73371</link>
      <description>&lt;P&gt;Not seeing &lt;CODE&gt;print&lt;/CODE&gt; in your github source. Borrowing from SO: &lt;A href="https://stackoverflow.com/questions/7152762/how-to-redirect-print-output-to-a-file-using-python#7152903"&gt;https://stackoverflow.com/questions/7152762/how-to-redirect-print-output-to-a-file-using-python#7152903&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;with open('out.txt', 'w') as f:
    print &amp;gt;&amp;gt; f, 'Filename:', filename     # Python 2.x
    print('Filename:', filename, file=f)  # Python 3.x
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Apr 2019 16:04:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-capture-the-output-of-a-script-from-a-scripted-input/m-p/414971#M73371</guid>
      <dc:creator>efavreau</dc:creator>
      <dc:date>2019-04-17T16:04:19Z</dc:date>
    </item>
  </channel>
</rss>

