<?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 get the stderr from a python command launched by a SearchManager in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/How-to-get-the-stderr-from-a-python-command-launched-by-a/m-p/160953#M2175</link>
    <description>&lt;P&gt;Basically the same way you are doing it to get results.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;mysearch.on('search:error', function(err) {
    console.log(err);
    });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See the webframework documentation here: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&lt;A href="http://docs.splunk.com/Documentation/WebFramework" target="test_blank"&gt;http://docs.splunk.com/Documentation/WebFramework&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 29 Jul 2014 11:18:39 GMT</pubDate>
    <dc:creator>alacercogitatus</dc:creator>
    <dc:date>2014-07-29T11:18:39Z</dc:date>
    <item>
      <title>How to get the stderr from a python command launched by a SearchManager</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-get-the-stderr-from-a-python-command-launched-by-a/m-p/160952#M2174</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I have a dashboard like that:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard script="doSearch.js"&amp;gt;
    &amp;lt;label&amp;gt;test query&amp;lt;/label&amp;gt;
    &amp;lt;row&amp;gt;
    &amp;lt;html&amp;gt;ciao&amp;lt;/html&amp;gt;
    &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and the js file is the following, taken from the searchmanager reference:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([
        'splunkjs/mvc',
        'splunkjs/mvc/utils',
        "splunkjs/mvc/searchmanager",
        "splunkjs/ready!"
    ], function (mvc) {
    var deps = [
        "splunkjs/ready!",

    ];
    require(deps, function (mvc) {
        var SearchManager = require("splunkjs/mvc/searchmanager");
        var mysearch = new SearchManager({
            id : "updatetthreatdb",
            search : "| script python test_command"
        });

        mysearch.on('search:failed', function (properties) {
            // Print the entire properties object
            console.log("FAILED:", properties);
        });

        mysearch.on('search:progress', function (properties) {      
            // Print just the event count from the search job
            console.log("IN PROGRESS.\nEvents so far:", properties.content.eventCount);
        });

        mysearch.on('search:done', function (properties) {
            // Print the search job properties
            console.log("DONE!\nSearch job properties:", properties.content);
        });

        mysearch.on('search:change', function(properties) {
        console.log(properties.content);
        });
    });
});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;the python command launches is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import sys
import time

sys.stderr.write("hi 1\r\n")
time.sleep(5)
sys.stderr.write("hi 2\r\n")
time.sleep(5)
sys.stderr.write("hi 3\r\n")
time.sleep(5)
sys.stderr.write("hi 4\r\n")
time.sleep(5)
sys.stderr.write("hi 5\r\n")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there a way to get (javascript side) the stderr messages printed by the script?&lt;BR /&gt;
thanks a lot!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2014 09:01:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-get-the-stderr-from-a-python-command-launched-by-a/m-p/160952#M2174</guid>
      <dc:creator>RiccardoV</dc:creator>
      <dc:date>2014-07-29T09:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the stderr from a python command launched by a SearchManager</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-get-the-stderr-from-a-python-command-launched-by-a/m-p/160953#M2175</link>
      <description>&lt;P&gt;Basically the same way you are doing it to get results.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;mysearch.on('search:error', function(err) {
    console.log(err);
    });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See the webframework documentation here: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&lt;A href="http://docs.splunk.com/Documentation/WebFramework" target="test_blank"&gt;http://docs.splunk.com/Documentation/WebFramework&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Jul 2014 11:18:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-get-the-stderr-from-a-python-command-launched-by-a/m-p/160953#M2175</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2014-07-29T11:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the stderr from a python command launched by a SearchManager</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-get-the-stderr-from-a-python-command-launched-by-a/m-p/160954#M2176</link>
      <description>&lt;P&gt;thanks for your answer.&lt;BR /&gt;
I tried with your solution but I see no log on the console.&lt;BR /&gt;
When the search is done I print the properties.content and I can see here the messages array with all my errors &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2014 11:46:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-get-the-stderr-from-a-python-command-launched-by-a/m-p/160954#M2176</guid>
      <dc:creator>RiccardoV</dc:creator>
      <dc:date>2014-07-29T11:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the stderr from a python command launched by a SearchManager</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-get-the-stderr-from-a-python-command-launched-by-a/m-p/160955#M2177</link>
      <description>&lt;P&gt;Hit me up on IRC, let's hash this out.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2014 11:50:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-get-the-stderr-from-a-python-command-launched-by-a/m-p/160955#M2177</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2014-07-29T11:50:04Z</dc:date>
    </item>
  </channel>
</rss>

