Splunk Dev

Problem with splunk and python commands in unix

asimmons1
New Member
splunkmonitormessage= subprocess.Popen(["sudo", "/opt/splunkforwarder/bin/splunk", "add monitor", path], stdin=subprocess.PIPE, stdout=subprocess.PIPE)

is throwing an error:

Command error: The subcommand
'/opt/logs/node_Default_Node.log'
is not valid for command 'add
monitor'. Data forwarding
configuration management tools.

Commands:
enable local-index [-parameter ] ...
disable local-index [-parameter ] ...
display local-index
add [forward-server|search-server] server
remove [forward-server|search-server] server
list [forward-server|search-server]

Objects:
forward-server a Splunk forwarder to forward data to be
indexed
search-server a Splunk server to forward searches
local-index a local search index on the Splunk server

sudo /opt/splunkforwarder/bin/splunk add monitor /opt/logs/node_Default_Node.log

works comepletely fine

What am I doing wrong?

Ive also tried str(path) in the python

Tags (3)
0 Karma

asimmons1
New Member

stackoverflow.com/a/24203342/3700086

answer found here

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...