<?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 Splunk Enterprise Security: Receiving errors &amp;quot;&amp;quot;A script exited abnormally&amp;quot; input=&amp;quot;.\bin\xxxx.py&amp;quot; stanza=&amp;quot;default&amp;quot; status=&amp;quot;exited with code 1&amp;quot;&amp;quot;. How to resolve? in Splunk Enterprise Security</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Splunk-Enterprise-Security-Receiving-errors-quot-quot-A-script/m-p/334568#M3129</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I keep receiving this error message from Splunk Enterprise Security (ES) on my custom python application, though the application is running fine.&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;2017-02-20 17:00:06,348 ERROR pid=8860 tid=MainThread file=configuration_check.py:run:165 | status="completed" task="confcheck_script_errors" message="msg="A script exited abnormally" input=".\bin\xxxx.py" stanza="default" status="exited with code 1""&lt;BR /&gt;
2017-02-20 17:00:06,404 ERROR pid=8860 tid=MainThread file=configuration_check.py:run:165 | status="completed" task="confcheck_script_errors" message="msg="A script exited abnormally" input=".\bin\yyyyy.py" stanza="default" status="exited with code 1"&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;anyone encounter this before? What is this error referring too and anyway to resolve/suppress this error? &lt;/P&gt;

&lt;P&gt;I have included this in the local/inouts.conf but does not work.&lt;BR /&gt;
&lt;EM&gt;[configuration_check://confcheck_script_errors]&lt;BR /&gt;
suppress = ((streamfwd|splunk-(wmi.path|MonitorNoHandle.exe|winevtlog.exe|netmon.exe|perfmon.exe|regmon.exe|winprintmon.exe|admon.exe|powershell.exe)).*exited with code 1)&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 13:05:58 GMT</pubDate>
    <dc:creator>dellytaniasetia</dc:creator>
    <dc:date>2020-09-29T13:05:58Z</dc:date>
    <item>
      <title>Splunk Enterprise Security: Receiving errors ""A script exited abnormally" input=".\bin\xxxx.py" stanza="default" status="exited with code 1"". How to resolve?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Splunk-Enterprise-Security-Receiving-errors-quot-quot-A-script/m-p/334568#M3129</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I keep receiving this error message from Splunk Enterprise Security (ES) on my custom python application, though the application is running fine.&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;2017-02-20 17:00:06,348 ERROR pid=8860 tid=MainThread file=configuration_check.py:run:165 | status="completed" task="confcheck_script_errors" message="msg="A script exited abnormally" input=".\bin\xxxx.py" stanza="default" status="exited with code 1""&lt;BR /&gt;
2017-02-20 17:00:06,404 ERROR pid=8860 tid=MainThread file=configuration_check.py:run:165 | status="completed" task="confcheck_script_errors" message="msg="A script exited abnormally" input=".\bin\yyyyy.py" stanza="default" status="exited with code 1"&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;anyone encounter this before? What is this error referring too and anyway to resolve/suppress this error? &lt;/P&gt;

&lt;P&gt;I have included this in the local/inouts.conf but does not work.&lt;BR /&gt;
&lt;EM&gt;[configuration_check://confcheck_script_errors]&lt;BR /&gt;
suppress = ((streamfwd|splunk-(wmi.path|MonitorNoHandle.exe|winevtlog.exe|netmon.exe|perfmon.exe|regmon.exe|winprintmon.exe|admon.exe|powershell.exe)).*exited with code 1)&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:05:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Splunk-Enterprise-Security-Receiving-errors-quot-quot-A-script/m-p/334568#M3129</guid>
      <dc:creator>dellytaniasetia</dc:creator>
      <dc:date>2020-09-29T13:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Enterprise Security: Receiving errors ""A script exited abnormally" input=".\bin\xxxx.py" stanza="default" status="exited with code 1"". How to resolve?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Splunk-Enterprise-Security-Receiving-errors-quot-quot-A-script/m-p/334569#M3130</link>
      <description>&lt;P&gt;You are picking up that error message because your default stanza for checking scripts considers any non-zero return code (such as 1) to be an error.  Your python script is returning a 1, so therefore it MUSt be an error, as far as that stanza is concerned.&lt;/P&gt;

&lt;P&gt;Your options are (1) if the script is returning 1 and does not have an error, fix the script to return zero (2) if the script is properly returning a 1 which is not an error,  then point the script at something other than the default. &lt;/P&gt;

&lt;P&gt;This page is very similar, but his solution was to copy code from an older version you wouldn't have.  &lt;A href="https://answers.splunk.com/answers/329819/alert-manager-script-exit-status-1.html"&gt;https://answers.splunk.com/answers/329819/alert-manager-script-exit-status-1.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;On this page, the error was bad indenting on the python script - &lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/145246/external-search-command-mypythonfile-returned-error-code-1-after-splunk-upgrade.html"&gt;https://answers.splunk.com/answers/145246/external-search-command-mypythonfile-returned-error-code-1-after-splunk-upgrade.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Additional information here - &lt;A href="https://answers.splunk.com/answers/99328/why-i-get-error-code-1.html"&gt;https://answers.splunk.com/answers/99328/why-i-get-error-code-1.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Here's another case where it was an error in the python code - &lt;A href="https://answers.splunk.com/answers/189517/why-am-i-getting-error-code-1-for-my-python-script.html"&gt;https://answers.splunk.com/answers/189517/why-am-i-getting-error-code-1-for-my-python-script.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;So, assuming the above survey of prior posts about this is typical, you probably have an error in your python code.  If you post it here, maybe we can give you more help.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 03:19:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Splunk-Enterprise-Security-Receiving-errors-quot-quot-A-script/m-p/334569#M3130</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-03-03T03:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Enterprise Security: Receiving errors ""A script exited abnormally" input=".\bin\xxxx.py" stanza="default" status="exited with code 1"". How to resolve?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Splunk-Enterprise-Security-Receiving-errors-quot-quot-A-script/m-p/334570#M3131</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Thanks for the suggestion. Are you able to elaborate the steps/any example for suggestion #2? What do you mean pointing the script to something other than the default?&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;(2) if the script is properly returning a 1 which is not an error, then point the script at something other than the default.&lt;/EM&gt; &lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 04:09:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Splunk-Enterprise-Security-Receiving-errors-quot-quot-A-script/m-p/334570#M3131</guid>
      <dc:creator>dellytaniasetia</dc:creator>
      <dc:date>2017-03-03T04:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Enterprise Security: Receiving errors ""A script exited abnormally" input=".\bin\xxxx.py" stanza="default" status="exited with code 1"". How to resolve?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/Splunk-Enterprise-Security-Receiving-errors-quot-quot-A-script/m-p/334571#M3132</link>
      <description>&lt;P&gt;Here is the python script.&lt;/P&gt;

&lt;P&gt;import re,collections,json,csv,sys,urllib,urllib2&lt;BR /&gt;
import requests&lt;BR /&gt;
import shutil,time,os&lt;BR /&gt;
import splunk.entity as entity&lt;BR /&gt;
import splunk.Intersplunk&lt;BR /&gt;
import argparse&lt;/P&gt;

&lt;P&gt;def sitereview(url,proxy,port,username,password):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;httpproxy = "{0}:{1}@{2}:{3}".format(username,password,proxy,port)
proxy_handler = urllib2.ProxyHandler({'http': httpproxy})

opener = urllib2.build_opener(proxy_handler)
urllib2.install_opener(opener)

baseurl = 'http://xxx/rest/categorization'
query_args = {'url': url}
data = urllib.urlencode(query_args)
headers = {'User-Agent':'Mozilla 5.10'} 
request = urllib2.Request(baseurl, data, headers)
response = urllib2.urlopen(request) 
json = response.read()

return json
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;def getCredentials(sessionKey):## added for getting the credentials&lt;BR /&gt;
    myapp = 'abc-app'&lt;BR /&gt;
    try: #list all credentials&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    entities = entity.getEntities("storage/passwords", namespace = myapp, owner = 'nobody', sessionKey = sessionKey)
except Exception, e:
    raise Exception("Could not get %s credentials from splunk. Error: %s" %(myapp, str(e)))

for i, c in entities.items():
    return c['username'], c['clear_password']
raise Exception("No credentials have been found")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;def main():&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;databasefile = "localcat.txt"

date = time.strftime("%Y%m%d")
newfile = databasefile +"_"+ date
shutil.copyfile(databasefile, newfile)
os.remove(databasefile)
destination = open(databasefile, "w")
source = open(newfile, "r")

proxy = 'PROXY'
port = '80'
#username = 'USERNAME'
#password = 'PASSWORD'
## added for getting the credential from the sessionkey
results, unused1, settings = splunk.Intersplunk.getOrganizedResults()
sessionKey = settings['sessionKey']
if len(sessionKey) == 0:
  sys.stderr.write("Did not receive a session key from splunkd.")
  sys.exit(0)
username, password = getCredentials(sessionKey)

for line in source:

    time.sleep(10)
    if 'define category test_Incident' in line:
        destination.write(line)

    elif 'end' in line:
        destination.write(line)  
    else:  
        result_json = sitereview(line,proxy,port,username,password)
        parsed_json = json.loads(result_json)
        unrated = str(parsed_json['unrated'])

        if unrated.lower() == 'true':
            destination.write(line)

source.close()
destination.close()
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;main()    &lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 04:20:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/Splunk-Enterprise-Security-Receiving-errors-quot-quot-A-script/m-p/334571#M3132</guid>
      <dc:creator>dellytaniasetia</dc:creator>
      <dc:date>2017-03-03T04:20:35Z</dc:date>
    </item>
  </channel>
</rss>

