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.
/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
Thank you so much, I will try that