Getting Data In

How to assign a Splunk status result to a variable in a script?

saifuddin9122
Path Finder

hello

I am working on a script for running Splunk.

I want to check status of Splunk and assign the result of the status to a variable for further use.
Can any one please help me with this?

0 Karma
1 Solution

somesoni2
Revered Legend

You can run following command and capture the output in a variable.
Shell script example

status=$($SPLUNK_HOME/bin/splunk status | grep not | wc -l )

If status=0, Splunk is up, down otherwise (1). Replace $SPLUNK_HOME with your installation path.

View solution in original post

somesoni2
Revered Legend

You can run following command and capture the output in a variable.
Shell script example

status=$($SPLUNK_HOME/bin/splunk status | grep not | wc -l )

If status=0, Splunk is up, down otherwise (1). Replace $SPLUNK_HOME with your installation path.

saifuddin9122
Path Finder

Thanks for your reply. it is working

0 Karma
Get Updates on the Splunk Community!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...