Monitoring Splunk

How do I script Splunk commands in shell script to execute?

wkrupinsky
Explorer

I am writing a shell script which I will execute with a cron job to clean eventdata from files daily.  How do I script Splunk commands in shell script to execute?

 

Here is what I have:

cd /datadrive/opt/splunk/bin
./splunk clean eventdata -index audit
y
./splunk clean eventdata -index _internal
y
./splunk clean eventdata -index _introspection
y
./splunk clean eventdata -index _metrics
y
./splunk clean eventdata -index _telemetry
y
./splunk start

 

 

Any and all help would be greatly appreciated.

Labels (1)
Tags (1)
0 Karma

woodcock
Esteemed Legend

/datadrive/opt/splunk/bin/splunk stop
/datadrive/opt/splunk/bin/splunk clean eventdata -index audit --answer-yes

/datadrive/opt/splunk/bin/splunk clean eventdata -index _internal --answer-yes
/datadrive/opt/splunk/bin/splunk clean eventdata -index _introspection --answer-yes
/datadrive/opt/splunk/bin/splunk clean eventdata -index _metrics --answer-yes
/datadrive/opt/splunk/bin/splunk clean eventdata -index _telemetry --answer-yes
/datadrive/opt/splunk/bin/splunk start

0 Karma

wkrupinsky
Explorer

Thank you so much, I will try that

0 Karma

somesoni2
Revered Legend
0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...