<?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 Why does Splunk scripted input not print data when script is turned off? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Why-does-Splunk-scripted-input-not-print-data-when-script-is/m-p/615295#M10771</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I am using python script to read from remote api with pagination. I have one problem while reading data from api, once i started script and it pulls data after that if i disable the script the data does not get printed in splunk though it has passed through print statement.&lt;/P&gt;</description>
    <pubDate>Fri, 30 Sep 2022 06:20:49 GMT</pubDate>
    <dc:creator>sumeet</dc:creator>
    <dc:date>2022-09-30T06:20:49Z</dc:date>
    <item>
      <title>Why does Splunk scripted input not print data when script is turned off?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-does-Splunk-scripted-input-not-print-data-when-script-is/m-p/615295#M10771</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I am using python script to read from remote api with pagination. I have one problem while reading data from api, once i started script and it pulls data after that if i disable the script the data does not get printed in splunk though it has passed through print statement.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 06:20:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-does-Splunk-scripted-input-not-print-data-when-script-is/m-p/615295#M10771</guid>
      <dc:creator>sumeet</dc:creator>
      <dc:date>2022-09-30T06:20:49Z</dc:date>
    </item>
    <item>
      <title>Re: Why does Splunk scripted input not print data when script is turned off?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-does-Splunk-scripted-input-not-print-data-when-script-is/m-p/615363#M10772</link>
      <description>Maybe I don' understand this right, but when you have disabled input then splunk don't run that script until you are reenabling that input.</description>
      <pubDate>Fri, 30 Sep 2022 10:43:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-does-Splunk-scripted-input-not-print-data-when-script-is/m-p/615363#M10772</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2022-09-30T10:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: Why does Splunk scripted input not print data when script is turned off?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-does-Splunk-scripted-input-not-print-data-when-script-is/m-p/615366#M10773</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214410"&gt;@isoutamo&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;In the below method we are looping through data and sending each event to splunk(for indexing) using print method. So while executing this method if we disable script through ui, it does not index any event to splunk and program is immediately terminated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example: We have 5 events to be indexed. So the for loop should execute print 5 times. Now, suppose it has executed it 2 times and now we disable the script through UI. Then the script will be terminated immediately and the two events which were sent using print function will also not be indexed.&lt;/P&gt;&lt;P&gt;Is it expected behaviour and how we could handle such cases gracefully?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;My code is like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def stream_to_splunk(self, data):
        for event in data:
            jsonData = json.dumps({"sourceType": self.sourceType, "event": event})
            print(jsonData)
            &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 11:33:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-does-Splunk-scripted-input-not-print-data-when-script-is/m-p/615366#M10773</guid>
      <dc:creator>sumeet</dc:creator>
      <dc:date>2022-09-30T11:33:07Z</dc:date>
    </item>
    <item>
      <title>Re: Why does Splunk scripted input not print data when script is turned off?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-does-Splunk-scripted-input-not-print-data-when-script-is/m-p/615399#M10775</link>
      <description>&lt;P&gt;I cannot recall how this has implemented, but my gut feelings is that this is how it has planned to working. I think that there is some buffering on sending events to splunk and when you are "stopping" it before it has finished it don't sent any events as it has just terminated and all buffers are cleared.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 14:01:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-does-Splunk-scripted-input-not-print-data-when-script-is/m-p/615399#M10775</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2022-09-30T14:01:00Z</dc:date>
    </item>
  </channel>
</rss>

