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!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...