Alerting

SPlunk disable alert with curl

SS1
Path Finder

Hi,

I use the below curl command to disable the alert which works fine.

curl -k -u admin:password https://<host>:<mgmt_port>/servicesNS/<user_context>/<app_context>/saved/searches/<search>/disable -X POST

 

But i am trying to hide the username and password in the below shell script but getting unauthorized exception, 

SCRIPT_DIR=/tmp/
USER=$(cat $SCRIPT_DIR/.nonprodusr.txt)
PWD=$(cat $SCRIPT_DIR/.nonprod.txt)

curl -k -u $USER:$PWD https://<host>:<mgmt_port>/servicesNS/<user_context>/<app_context>/saved/searches/<search>/disable -X POST

 

Labels (4)
0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@SS1 

Can you please try this?

SCRIPT_DIR="/tmp/"
USER=$(cat $SCRIPT_DIR/nonprodusr.txt)
PWD=$(cat $SCRIPT_DIR/nonprod.txt)

curl -k -u $USER:$PWD https://<host>:<mgmt_port>/servicesNS/<user_context>/<app_context>/saved/searches/<search>/disable -X POST

 

Thanks
KV
▄︻̷̿┻̿═━一

If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.

 

0 Karma
Get Updates on the Splunk Community!

Index This | When is October more than just the tenth month?

October 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What’s New & Next in Splunk SOAR

 Security teams today are dealing with more alerts, more tools, and more pressure than ever.  Join us for an ...