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!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...