Scripts as inputs

Splunk will periodically execute processes and capture the output. For example, here is input from the ImplementingSplunkDataGenerator app:

[script://./bin/implSplunkGen.py 2] 
interval=60 
sourcetype=impl_splunk_gen_sourcetype2 
source=impl_splunk_gen_src2 
host=host2 
index=implSplunk 

Things to note in this example are as follows:

  • The present working directory is the root of the app that contains inputs.conf.
  • Files that end with .py will be executed using the Python interpreter included with Splunk. This means the Splunk Python modules are available. To use a different Python module, specify the path to Python in the stanza.
  • Any arguments specified in the stanza will be handed to the script as if it was executed at the command ...

Get Implementing Splunk 7 - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.