splunk / splunk-sdk-python

Splunk Software Development Kit for Python
http://dev.splunk.com
Apache License 2.0
698 stars 370 forks source link

Getinfo fails in examples #108

Closed kkirsche closed 9 years ago

kkirsche commented 9 years ago

Hey,

I tried to use the example search commands app to begin developing my own applications for splunk. Sadly, the example provided fails with the error message:

Error in 'script': Getinfo probe failed for external search command 'generatehello'
The search job has failed due to an error. You may be able view the job in the Job Inspector. 

Any idea why the examples don't work?

David-Noble-at-work commented 9 years ago

You will likely find the answer in the search.log file that’s accessible from the job inspector page. One common cause is not having a copy of splunklib on $SPLUNK_HOME/etc/apps/searchcommands_app/bin. Is $SPLUNK_HOME/etc/apps/searchcommands_app/bin/splunklib present?

On Jun 26, 2015, at 11:37 AM, Kevin Kirsche notifications@github.com<mailto:notifications@github.com> wrote:

Hey,

I tried to use the example search commands app to begin developing my own applications for splunk. Sadly, the example provided fails with the error message:

Error in 'script': Getinfo probe failed for external search command 'generatehello' The search job has failed due to an error. You may be able view the job in the Job Inspector.

Any idea why the examples don't work?

— Reply to this email directly or view it on GitHubhttps://github.com/splunk/splunk-sdk-python/issues/108.

kkirsche commented 9 years ago

@David-Noble-at-work Yes, I do have splunklib under $SPLUNK_HOME/etc/apps/searchcommands_app/bin

screen shot 2015-06-26 at 3 21 57 pm

David-Noble-at-work commented 9 years ago

This looks good. Can you attach a copy the search.log file? There’s a link to it on the Job Inspector page which you can access from the Job dropdown below the search bar on the right-hand side.

On Jun 26, 2015, at 12:22 PM, Kevin Kirsche notifications@github.com<mailto:notifications@github.com> wrote:

@David-Noble-at-workhttps://github.com/David-Noble-at-work Yes, I do have splunklib under $SPLUNK_HOME/etc/apps/searchcommands_app/bin

[screen shot 2015-06-26 at 3 21 57 pm]https://cloud.githubusercontent.com/assets/947110/8385567/1c7ee7b8-1c17-11e5-8627-56827457e91d.png

— Reply to this email directly or view it on GitHubhttps://github.com/splunk/splunk-sdk-python/issues/108#issuecomment-115845282.

kkirsche commented 9 years ago

Of course, thank you.

06-26-2015 15:51:41.207 INFO  dispatchRunner - initing LicenseMgr in search process: nonPro=0
06-26-2015 15:51:41.207 INFO  dispatchRunner - registering build time modules, count=0
06-26-2015 15:51:41.207 INFO  dispatchRunner - Splunkd starting (build 264376).
06-26-2015 15:51:41.207 INFO  dispatchRunner - System info: Linux, ubuntu, 3.16.0-30-generic, #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14 UTC 2015, x86_64.
06-26-2015 15:51:41.207 INFO  dispatchRunner - Detected 2 (virtual) CPUs, 2 CPU cores, and 990MB RAM
06-26-2015 15:51:41.207 INFO  dispatchRunner - Maximum number of threads (approximate): 495
06-26-2015 15:51:41.207 INFO  dispatchRunner - Arguments are: "search" "--id=1435348301.13" "--maxbuckets=300" "--ttl=600" "--maxout=500000" "--maxtime=8640000" "--lookups=1" "--reduce_freq=10" "--rf=*" "--user=admin" "--pro" "--roles=admin:power:user"
06-26-2015 15:51:41.207 INFO  dispatchRunner - Getting search configuration data from: /opt/splunk/etc/modules/parsing/config.xml
06-26-2015 15:51:41.211 INFO  BundlesSetup - Setup stats for /opt/splunk/etc: wallclock_elapsed_msec=10, cpu_time_used=0.008094, shared_services_generation=2, shared_services_population=1
06-26-2015 15:51:41.215 INFO  UserManagerPro - Load authentication: forcing roles="admin, power, user"
06-26-2015 15:51:41.229 INFO  SessionManager - auth tokens will be generated with shpooling shared secret
06-26-2015 15:51:41.229 INFO  UserManager - Setting user context: splunk-system-user
06-26-2015 15:51:41.229 INFO  UserManager - Done setting user context: NULL -> splunk-system-user
06-26-2015 15:51:41.230 INFO  UserManager - Unwound user context: splunk-system-user -> NULL
06-26-2015 15:51:41.230 INFO  UserManager - Setting user context: admin
06-26-2015 15:51:41.230 INFO  UserManager - Done setting user context: NULL -> admin
06-26-2015 15:51:41.233 INFO  dispatchRunner - search context: user="admin", app="custom_commands", bs-pathname="/opt/splunk/etc"
06-26-2015 15:51:41.234 INFO  IndexProcessor - Initializing: readonly=true reloading=false
06-26-2015 15:51:41.235 INFO  HotDBManager - idx=_audit Setting hot mgr params: maxHotSpanSecs=7776000 snapBucketTimespans=false maxHotBuckets=3 maxDataSizeBytes=786432000 quarantinePastSecs=77760000 quarantineFutureSecs=2592000 
06-26-2015 15:51:41.235 INFO  AuditTrailManager - audit stanza does not exist in audit.conf - no signing will take place
06-26-2015 15:51:41.235 INFO  HotDBManager - idx=_blocksignature Setting hot mgr params: maxHotSpanSecs=7776000 snapBucketTimespans=false maxHotBuckets=3 maxDataSizeBytes=1048576000 quarantinePastSecs=77760000 quarantineFutureSecs=2592000 
06-26-2015 15:51:41.235 INFO  AuditTrailManager - audit stanza does not exist in audit.conf - no signing will take place
06-26-2015 15:51:41.235 INFO  HotDBManager - idx=_internal Setting hot mgr params: maxHotSpanSecs=432000 snapBucketTimespans=false maxHotBuckets=3 maxDataSizeBytes=1048576000 quarantinePastSecs=77760000 quarantineFutureSecs=2592000 
06-26-2015 15:51:41.235 INFO  AuditTrailManager - audit stanza does not exist in audit.conf - no signing will take place
06-26-2015 15:51:41.235 INFO  HotDBManager - idx=_introspection Setting hot mgr params: maxHotSpanSecs=7776000 snapBucketTimespans=false maxHotBuckets=3 maxDataSizeBytes=1073741824 quarantinePastSecs=77760000 quarantineFutureSecs=2592000 
06-26-2015 15:51:41.235 INFO  AuditTrailManager - audit stanza does not exist in audit.conf - no signing will take place
06-26-2015 15:51:41.235 INFO  HotDBManager - idx=_thefishbucket Setting hot mgr params: maxHotSpanSecs=7776000 snapBucketTimespans=false maxHotBuckets=3 maxDataSizeBytes=524288000 quarantinePastSecs=77760000 quarantineFutureSecs=2592000 
06-26-2015 15:51:41.235 INFO  AuditTrailManager - audit stanza does not exist in audit.conf - no signing will take place
06-26-2015 15:51:41.235 INFO  HotDBManager - idx=history Setting hot mgr params: maxHotSpanSecs=7776000 snapBucketTimespans=false maxHotBuckets=3 maxDataSizeBytes=10485760 quarantinePastSecs=77760000 quarantineFutureSecs=2592000 
06-26-2015 15:51:41.235 INFO  AuditTrailManager - audit stanza does not exist in audit.conf - no signing will take place
06-26-2015 15:51:41.235 INFO  HotDBManager - idx=main Setting hot mgr params: maxHotSpanSecs=7776000 snapBucketTimespans=false maxHotBuckets=10 maxDataSizeBytes=10737418240 quarantinePastSecs=77760000 quarantineFutureSecs=2592000 
06-26-2015 15:51:41.235 INFO  AuditTrailManager - audit stanza does not exist in audit.conf - no signing will take place
06-26-2015 15:51:41.235 INFO  HotDBManager - idx=summary Setting hot mgr params: maxHotSpanSecs=7776000 snapBucketTimespans=false maxHotBuckets=3 maxDataSizeBytes=786432000 quarantinePastSecs=77760000 quarantineFutureSecs=2592000 
06-26-2015 15:51:41.235 INFO  AuditTrailManager - audit stanza does not exist in audit.conf - no signing will take place
06-26-2015 15:51:41.235 INFO  IndexProcessor - Initializing indexes took usec=210 reloading=false indexes_initialized=8
06-26-2015 15:51:41.235 INFO  SearchParser - PARSING: |generatehello
06-26-2015 15:51:41.244 INFO  ISplunkDispatch - Not running in splunkd. Bundle replication not triggered.
06-26-2015 15:51:41.246 INFO  UserManager - Setting user context: admin
06-26-2015 15:51:41.246 INFO  UserManager - Done setting user context: NULL -> admin
06-26-2015 15:51:41.251 INFO  script - found script file=/opt/splunk/etc/apps/custom_commands/bin/generatehello.py
06-26-2015 15:51:41.251 INFO  script - stderr for script generatehello will be added to search.log
06-26-2015 15:51:41.450 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py __GETINFO__':  Traceback (most recent call last):
06-26-2015 15:51:41.450 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py __GETINFO__':    File "/opt/splunk/etc/apps/custom_commands/bin/generatehello.py", line 30, in <module>
06-26-2015 15:51:41.450 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py __GETINFO__':      dispatch(GenerateHelloCommand, sys.argv, sys.stdin, sys.stdout, __name__)
06-26-2015 15:51:41.450 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py __GETINFO__':    File "/opt/splunk/etc/apps/custom_commands/bin/splunklib/searchcommands/__init__.py", line 224, in dispatch
06-26-2015 15:51:41.450 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py __GETINFO__':      command_class().process(argv, input_file, output_file)
06-26-2015 15:51:41.450 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py __GETINFO__':    File "/opt/splunk/etc/apps/custom_commands/bin/splunklib/searchcommands/search_command.py", line 342, in process
06-26-2015 15:51:41.450 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py __GETINFO__':      self.logger.error(traceback.format_exc(error_traceback))
06-26-2015 15:51:41.450 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py __GETINFO__':    File "/opt/splunk/lib/python2.7/logging/__init__.py", line 1186, in error
06-26-2015 15:51:41.451 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py __GETINFO__':      self._log(ERROR, msg, args, **kwargs)
06-26-2015 15:51:41.451 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py __GETINFO__':    File "/opt/splunk/lib/python2.7/logging/__init__.py", line 1279, in _log
06-26-2015 15:51:41.451 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py __GETINFO__':      self.handle(record)
06-26-2015 15:51:41.451 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py __GETINFO__':    File "/opt/splunk/lib/python2.7/logging/__init__.py", line 1289, in handle
06-26-2015 15:51:41.451 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py __GETINFO__':      self.callHandlers(record)
06-26-2015 15:51:41.451 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py __GETINFO__':    File "/opt/splunk/lib/python2.7/logging/__init__.py", line 1329, in callHandlers
06-26-2015 15:51:41.451 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py __GETINFO__':      hdlr.handle(record)
06-26-2015 15:51:41.451 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py __GETINFO__':    File "/opt/splunk/lib/python2.7/logging/__init__.py", line 757, in handle
06-26-2015 15:51:41.452 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py __GETINFO__':      self.emit(record)
06-26-2015 15:51:41.452 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py __GETINFO__':    File "/opt/splunk/lib/python2.7/logging/__init__.py", line 949, in emit
06-26-2015 15:51:41.452 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py __GETINFO__':      self.stream = self._open()
06-26-2015 15:51:41.452 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py __GETINFO__':    File "/opt/splunk/lib/python2.7/logging/__init__.py", line 938, in _open
06-26-2015 15:51:41.452 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py __GETINFO__':      stream = codecs.open(self.baseFilename, self.mode, self.encoding)
06-26-2015 15:51:41.452 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py __GETINFO__':    File "/opt/splunk/lib/python2.7/codecs.py", line 878, in open
06-26-2015 15:51:41.453 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py __GETINFO__':      file = __builtin__.open(filename, mode, buffering)
06-26-2015 15:51:41.453 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py __GETINFO__':  IOError: [Errno 13] Permission denied: '/opt/splunk/etc/apps/custom_commands/searchcommand_app.log'
06-26-2015 15:51:41.457 ERROR script - Getinfo probe failed for external search command 'generatehello'
06-26-2015 15:51:41.460 INFO  UserManager - Unwound user context: admin -> NULL
06-26-2015 15:51:41.461 INFO  UserManager - Setting user context: admin
06-26-2015 15:51:41.461 INFO  UserManager - Done setting user context: NULL -> admin
06-26-2015 15:51:41.461 INFO  UserManager - Unwound user context: admin -> NULL
06-26-2015 15:51:41.461 INFO  DispatchManager - DispatchManager::dispatchHasFinished(id='1435348301.13', username='admin')
06-26-2015 15:51:41.461 INFO  UserManager - Unwound user context: admin -> NULL
06-26-2015 15:51:41.468 INFO  ShutdownHandler - Shutting down splunkd
06-26-2015 15:51:41.468 INFO  ShutdownHandler - shutting down level "ShutdownLevel_Begin"
06-26-2015 15:51:41.468 INFO  ShutdownHandler - shutting down level "ShutdownLevel_KVStore"
06-26-2015 15:51:41.468 INFO  ShutdownHandler - shutting down level "ShutdownLevel_Thruput"
06-26-2015 15:51:41.468 INFO  ShutdownHandler - shutting down level "ShutdownLevel_TcpInput1"
06-26-2015 15:51:41.468 INFO  ShutdownHandler - shutting down level "ShutdownLevel_TcpOutput"
06-26-2015 15:51:41.468 INFO  ShutdownHandler - shutting down level "ShutdownLevel_UdpInput"
06-26-2015 15:51:41.468 INFO  ShutdownHandler - shutting down level "ShutdownLevel_FifoInput"
06-26-2015 15:51:41.468 INFO  ShutdownHandler - shutting down level "ShutdownLevel_WinEventLogInput"
06-26-2015 15:51:41.468 INFO  ShutdownHandler - shutting down level "ShutdownLevel_Scheduler"
06-26-2015 15:51:41.468 INFO  ShutdownHandler - shutting down level "ShutdownLevel_Tailing"
06-26-2015 15:51:41.468 INFO  ShutdownHandler - shutting down level "ShutdownLevel_SyslogOutput"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_HTTPOutput"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_TailingXP"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_BatchReader"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_PeerManager"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_ArchiveAndOneshot"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_AuditTrailManager"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_AuditTrailQueueServiceThread"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_FSChangeMonitor"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_FSChangeManagerProcessor"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_HttpClientPollingThread"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_AsyncQueuedMessageDispatcherThread"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_OfflineFlusher"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_Slave"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_SlaveSearch"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_Select"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_IdataDO_Collector"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_TcpOutput2"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_Database1"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_TcpInput2"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_LoadLDAPUsers"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_MetricsManager"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_Pipeline"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_Queue"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_Exec"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_CallbackRunner"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - shutting down level "ShutdownLevel_HttpClient"
06-26-2015 15:51:41.469 INFO  ShutdownHandler - Shutdown complete in 162 microseconds
06-26-2015 15:51:41.469 ERROR dispatchRunner - RunDispatch::runDispatchThread threw error: Error in 'script': Getinfo probe failed for external search command 'generatehello'

And the generate hello command file is:

#!/usr/bin/env python
#
# Copyright 2011-2014 Splunk, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"): you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

import sys, time
from splunklib.searchcommands import \
    dispatch, GeneratingCommand, Configuration, Option, validators

@Configuration()
class GenerateHelloCommand(GeneratingCommand):
    count = Option(require=True, validate=validators.Integer())

    def generate(self):
        for i in range(1, self.count + 1):
            text = 'Hello World %d' % i
            yield {'_time': time.time(), 'event_no': i, '_raw': text } 

dispatch(GenerateHelloCommand, sys.argv, sys.stdin, sys.stdout, __name__)
kkirsche commented 9 years ago

Ah, this was a stupid permission issue. Thanks for helping me even find that data

David-Noble-at-work commented 9 years ago

The app has not got permission to write to '/opt/splunk/etc/apps/custom_commands/searchcommand_app.log’. Note this line in the search.log file:

IOError: [Errno 13] Permission denied: '/opt/splunk/etc/apps/custom_commands/searchcommand_app.log’

You can fix that in at least two ways:

Specifically, change this stanza

[handler_file]

Select this handler to log events to $SPLUNK_HOME/etc/apps/searchcommands_app/searchcommands_app.log

class = logging.FileHandler level = NOTSET args = ('searchcommand_app.log', 'a', 'utf-8', True) formatter = search_command

to, perhaps, something like this:

[handler_file]

Select this handler to log events to $SPLUNK_HOME/etc/apps/searchcommands_app/searchcommands_app.log

class = logging.FileHandler level = NOTSET args = (‘/opt/splunk/var/log/splunk/searchcommand_app.log', 'a', 'utf-8', True) formatter = search_command

Best, David Noble Splunk Seattle

On Jun 26, 2015, at 12:54 PM, Kevin Kirsche notifications@github.com<mailto:notifications@github.com> wrote:

Of course, thank you.

06-26-2015 15:51:41.207 INFO dispatchRunner - initing LicenseMgr in search process: nonPro=0 06-26-2015 15:51:41.207 INFO dispatchRunner - registering build time modules, count=0 06-26-2015 15:51:41.207 INFO dispatchRunner - Splunkd starting (build 264376). 06-26-2015 15:51:41.207 INFO dispatchRunner - System info: Linux, ubuntu, 3.16.0-30-generic, #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14 UTC 2015, x86_64. 06-26-2015 15:51:41.207 INFO dispatchRunner - Detected 2 (virtual) CPUs, 2 CPU cores, and 990MB RAM 06-26-2015 15:51:41.207 INFO dispatchRunner - Maximum number of threads (approximate): 495 06-26-2015 15:51:41.207 INFO dispatchRunner - Arguments are: "search" "--id=1435348301.13" "--maxbuckets=300" "--ttl=600" "--maxout=500000" "--maxtime=8640000" "--lookups=1" "--reducefreq=10" "--rf=" "--user=admin" "--pro" "--roles=admin:power:user" 06-26-2015 15:51:41.207 INFO dispatchRunner - Getting search configuration data from: /opt/splunk/etc/modules/parsing/config.xml 06-26-2015 15:51:41.211 INFO BundlesSetup - Setup stats for /opt/splunk/etc: wallclock_elapsed_msec=10, cpu_time_used=0.008094, shared_services_generation=2, shared_services_population=1 06-26-2015 15:51:41.215 INFO UserManagerPro - Load authentication: forcing roles="admin, power, user" 06-26-2015 15:51:41.229 INFO SessionManager - auth tokens will be generated with shpooling shared secret 06-26-2015 15:51:41.229 INFO UserManager - Setting user context: splunk-system-user 06-26-2015 15:51:41.229 INFO UserManager - Done setting user context: NULL -> splunk-system-user 06-26-2015 15:51:41.230 INFO UserManager - Unwound user context: splunk-system-user -> NULL 06-26-2015 15:51:41.230 INFO UserManager - Setting user context: admin 06-26-2015 15:51:41.230 INFO UserManager - Done setting user context: NULL -> admin 06-26-2015 15:51:41.233 INFO dispatchRunner - search context: user="admin", app="custom_commands", bs-pathname="/opt/splunk/etc" 06-26-2015 15:51:41.234 INFO IndexProcessor - Initializing: readonly=true reloading=false 06-26-2015 15:51:41.235 INFO HotDBManager - idx=_audit Setting hot mgr params: maxHotSpanSecs=7776000 snapBucketTimespans=false maxHotBuckets=3 maxDataSizeBytes=786432000 quarantinePastSecs=77760000 quarantineFutureSecs=2592000 06-26-2015 15:51:41.235 INFO AuditTrailManager - audit stanza does not exist in audit.conf - no signing will take place 06-26-2015 15:51:41.235 INFO HotDBManager - idx=_blocksignature Setting hot mgr params: maxHotSpanSecs=7776000 snapBucketTimespans=false maxHotBuckets=3 maxDataSizeBytes=1048576000 quarantinePastSecs=77760000 quarantineFutureSecs=2592000 06-26-2015 15:51:41.235 INFO AuditTrailManager - audit stanza does not exist in audit.conf - no signing will take place 06-26-2015 15:51:41.235 INFO HotDBManager - idx=_internal Setting hot mgr params: maxHotSpanSecs=432000 snapBucketTimespans=false maxHotBuckets=3 maxDataSizeBytes=1048576000 quarantinePastSecs=77760000 quarantineFutureSecs=2592000 06-26-2015 15:51:41.235 INFO AuditTrailManager - audit stanza does not exist in audit.conf - no signing will take place 06-26-2015 15:51:41.235 INFO HotDBManager - idx=_introspection Setting hot mgr params: maxHotSpanSecs=7776000 snapBucketTimespans=false maxHotBuckets=3 maxDataSizeBytes=1073741824 quarantinePastSecs=77760000 quarantineFutureSecs=2592000 06-26-2015 15:51:41.235 INFO AuditTrailManager - audit stanza does not exist in audit.conf - no signing will take place 06-26-2015 15:51:41.235 INFO HotDBManager - idx=_thefishbucket Setting hot mgr params: maxHotSpanSecs=7776000 snapBucketTimespans=false maxHotBuckets=3 maxDataSizeBytes=524288000 quarantinePastSecs=77760000 quarantineFutureSecs=2592000 06-26-2015 15:51:41.235 INFO AuditTrailManager - audit stanza does not exist in audit.conf - no signing will take place 06-26-2015 15:51:41.235 INFO HotDBManager - idx=history Setting hot mgr params: maxHotSpanSecs=7776000 snapBucketTimespans=false maxHotBuckets=3 maxDataSizeBytes=10485760 quarantinePastSecs=77760000 quarantineFutureSecs=2592000 06-26-2015 15:51:41.235 INFO AuditTrailManager - audit stanza does not exist in audit.conf - no signing will take place 06-26-2015 15:51:41.235 INFO HotDBManager - idx=main Setting hot mgr params: maxHotSpanSecs=7776000 snapBucketTimespans=false maxHotBuckets=10 maxDataSizeBytes=10737418240 quarantinePastSecs=77760000 quarantineFutureSecs=2592000 06-26-2015 15:51:41.235 INFO AuditTrailManager - audit stanza does not exist in audit.conf - no signing will take place 06-26-2015 15:51:41.235 INFO HotDBManager - idx=summary Setting hot mgr params: maxHotSpanSecs=7776000 snapBucketTimespans=false maxHotBuckets=3 maxDataSizeBytes=786432000 quarantinePastSecs=77760000 quarantineFutureSecs=2592000 06-26-2015 15:51:41.235 INFO AuditTrailManager - audit stanza does not exist in audit.conf - no signing will take place 06-26-2015 15:51:41.235 INFO IndexProcessor - Initializing indexes took usec=210 reloading=false indexes_initialized=8 06-26-2015 15:51:41.235 INFO SearchParser - PARSING: |generatehello 06-26-2015 15:51:41.244 INFO ISplunkDispatch - Not running in splunkd. Bundle replication not triggered. 06-26-2015 15:51:41.246 INFO UserManager - Setting user context: admin 06-26-2015 15:51:41.246 INFO UserManager - Done setting user context: NULL -> admin 06-26-2015 15:51:41.251 INFO script - found script file=/opt/splunk/etc/apps/custom_commands/bin/generatehello.py 06-26-2015 15:51:41.251 INFO script - stderr for script generatehello will be added to search.log 06-26-2015 15:51:41.450 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py GETINFO': Traceback (most recent call last): 06-26-2015 15:51:41.450 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py GETINFO': File "/opt/splunk/etc/apps/custom_commands/bin/generatehello.py", line 30, in 06-26-2015 15:51:41.450 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py GETINFO': dispatch(GenerateHelloCommand, sys.argv, sys.stdin, sys.stdout, name) 06-26-2015 15:51:41.450 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py GETINFO': File "/opt/splunk/etc/apps/custom_commands/bin/splunklib/searchcommands/init.py", line 224, in dispatch 06-26-2015 15:51:41.450 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py GETINFO': command_class().process(argv, input_file, output_file) 06-26-2015 15:51:41.450 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py GETINFO': File "/opt/splunk/etc/apps/custom_commands/bin/splunklib/searchcommands/search_command.py", line 342, in process 06-26-2015 15:51:41.450 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py GETINFO': self.logger.error(traceback.format_exc(error_traceback)) 06-26-2015 15:51:41.450 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py GETINFO': File "/opt/splunk/lib/python2.7/logging/init.py", line 1186, in error 06-26-2015 15:51:41.451 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py GETINFO': self._log(ERROR, msg, args, *_kwargs) 06-26-2015 15:51:41.451 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py GETINFO': File "/opt/splunk/lib/python2.7/logging/init.py", line 1279, in _log 06-26-2015 15:51:41.451 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py GETINFO': self.handle(record) 06-26-2015 15:51:41.451 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py GETINFO': File "/opt/splunk/lib/python2.7/logging/init.py", line 1289, in handle 06-26-2015 15:51:41.451 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py GETINFO': self.callHandlers(record) 06-26-2015 15:51:41.451 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py GETINFO': File "/opt/splunk/lib/python2.7/logging/init.py", line 1329, in callHandlers 06-26-2015 15:51:41.451 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py GETINFO': hdlr.handle(record) 06-26-2015 15:51:41.451 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py GETINFO': File "/opt/splunk/lib/python2.7/logging/init.py", line 757, in handle 06-26-2015 15:51:41.452 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py GETINFO': self.emit(record) 06-26-2015 15:51:41.452 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py GETINFO': File "/opt/splunk/lib/python2.7/logging/init.py", line 949, in emit 06-26-2015 15:51:41.452 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py GETINFO': self.stream = self._open() 06-26-2015 15:51:41.452 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py GETINFO': File "/opt/splunk/lib/python2.7/logging/init.py", line 938, in _open 06-26-2015 15:51:41.452 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py GETINFO': stream = codecs.open(self.baseFilename, self.mode, self.encoding) 06-26-2015 15:51:41.452 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py GETINFO': File "/opt/splunk/lib/python2.7/codecs.py", line 878, in open 06-26-2015 15:51:41.453 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py GETINFO': file = builtin.open(filename, mode, buffering) 06-26-2015 15:51:41.453 ERROR ScriptRunner - stderr from '/opt/splunk/bin/python /opt/splunk/etc/apps/custom_commands/bin/generatehello.py GETINFO': IOError: [Errno 13] Permission denied: '/opt/splunk/etc/apps/custom_commands/searchcommand_app.log' 06-26-2015 15:51:41.457 ERROR script - Getinfo probe failed for external search command 'generatehello' 06-26-2015 15:51:41.460 INFO UserManager - Unwound user context: admin -> NULL 06-26-2015 15:51:41.461 INFO UserManager - Setting user context: admin 06-26-2015 15:51:41.461 INFO UserManager - Done setting user context: NULL -> admin 06-26-2015 15:51:41.461 INFO UserManager - Unwound user context: admin -> NULL 06-26-2015 15:51:41.461 INFO DispatchManager - DispatchManager::dispatchHasFinished(id='1435348301.13', username='admin') 06-26-2015 15:51:41.461 INFO UserManager - Unwound user context: admin -> NULL 06-26-2015 15:51:41.468 INFO ShutdownHandler - Shutting down splunkd 06-26-2015 15:51:41.468 INFO ShutdownHandler - shutting down level "ShutdownLevel_Begin" 06-26-2015 15:51:41.468 INFO ShutdownHandler - shutting down level "ShutdownLevel_KVStore" 06-26-2015 15:51:41.468 INFO ShutdownHandler - shutting down level "ShutdownLevel_Thruput" 06-26-2015 15:51:41.468 INFO ShutdownHandler - shutting down level "ShutdownLevel_TcpInput1" 06-26-2015 15:51:41.468 INFO ShutdownHandler - shutting down level "ShutdownLevel_TcpOutput" 06-26-2015 15:51:41.468 INFO ShutdownHandler - shutting down level "ShutdownLevel_UdpInput" 06-26-2015 15:51:41.468 INFO ShutdownHandler - shutting down level "ShutdownLevel_FifoInput" 06-26-2015 15:51:41.468 INFO ShutdownHandler - shutting down level "ShutdownLevel_WinEventLogInput" 06-26-2015 15:51:41.468 INFO ShutdownHandler - shutting down level "ShutdownLevel_Scheduler" 06-26-2015 15:51:41.468 INFO ShutdownHandler - shutting down level "ShutdownLevel_Tailing" 06-26-2015 15:51:41.468 INFO ShutdownHandler - shutting down level "ShutdownLevel_SyslogOutput" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_HTTPOutput" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_TailingXP" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_BatchReader" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_PeerManager" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_ArchiveAndOneshot" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_AuditTrailManager" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_AuditTrailQueueServiceThread" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_FSChangeMonitor" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_FSChangeManagerProcessor" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_HttpClientPollingThread" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_AsyncQueuedMessageDispatcherThread" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_OfflineFlusher" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_Slave" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_SlaveSearch" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_Select" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_IdataDO_Collector" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_TcpOutput2" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_Database1" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_TcpInput2" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_LoadLDAPUsers" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_MetricsManager" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_Pipeline" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_Queue" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_Exec" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_CallbackRunner" 06-26-2015 15:51:41.469 INFO ShutdownHandler - shutting down level "ShutdownLevel_HttpClient" 06-26-2015 15:51:41.469 INFO ShutdownHandler - Shutdown complete in 162 microseconds 06-26-2015 15:51:41.469 ERROR dispatchRunner - RunDispatch::runDispatchThread threw error: Error in 'script': Getinfo probe failed for external search command 'generatehello'

And the generate hello command file is:

!/usr/bin/env python

#

Copyright 2011-2014 Splunk, Inc.

#

Licensed under the Apache License, Version 2.0 (the "License"): you may

not use this file except in compliance with the License. You may obtain

a copy of the License at

#

http://www.apache.org/licenses/LICENSE-2.0

#

Unless required by applicable law or agreed to in writing, software

distributed under the License is distributed on an "AS IS" BASIS, WITHOUT

WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the

License for the specific language governing permissions and limitations

under the License.

import sys, time from splunklib.searchcommands import \ dispatch, GeneratingCommand, Configuration, Option, validators

@Configuration() class GenerateHelloCommand(GeneratingCommand): count = Option(require=True, validate=validators.Integer())

def generate(self):
    for i in range(1, self.count + 1):
        text = 'Hello World %d' % i
        yield {'_time': time.time(), 'event_no': i, '_raw': text }

dispatch(GenerateHelloCommand, sys.argv, sys.stdin, sys.stdout, name)

— Reply to this email directly or view it on GitHubhttps://github.com/splunk/splunk-sdk-python/issues/108#issuecomment-115855033.

David-Noble-at-work commented 9 years ago

You’re welcome.

On Jun 26, 2015, at 12:57 PM, Kevin Kirsche notifications@github.com<mailto:notifications@github.com> wrote:

Closed #108https://github.com/splunk/splunk-sdk-python/issues/108.

— Reply to this email directly or view it on GitHubhttps://github.com/splunk/splunk-sdk-python/issues/108#event-341570216.