Getting Data In

Logging output from clean-dispatch

rmorlen
Splunk Employee
Splunk Employee

I have a script that runs when certain events occur. This script cleans the dispatch directory. I would like to log the output of this command so that I can track when the script runs and what it did.

I am not a linux guru and have tried:

/opt/splunk/bin/splunk cmd splunkd clean-dispatch /temp -1d -1d | tee -a /opt/splunk/var/log/splunk/internalscripts.log

and

/opt/splunk/bin/splunk cmd splunkd clean-dispatch /temp -1d -1d >> tee -a /opt/splunk/var/log/splunk/internalscripts.log

Neither writes to the logfile. Is there another way of writing the output to the logfile?

Thanks.

Tags (1)
0 Karma

rmorlen
Splunk Employee
Splunk Employee

Sorry for wasting time. The command below works (not sure why it didn't show up in the log before):

/opt/splunk/bin/splunk cmd splunkd clean-dispatch /temp -1d -1d | tee -a /opt/splunk/var/log/splunk/internalscripts.log

0 Karma

rmorlen
Splunk Employee
Splunk Employee

The command /opt/splunk/bin/splunk cmd splunkd clean-dispatch /temp -1d -1d works fine.

0 Karma

jonuwz
Influencer

The 2nd option above should read
/opt/splunk/bin/splunk cmd splunkd clean-dispatch /temp -1d -1d >> /opt/splunk/var/log/splunk/internalscripts.log

Also, does /temp exist ? Maybe this should be /tmp ?

0 Karma
Get Updates on the Splunk Community!

A Prelude to .conf25: Your Guide to Splunk University

Heading to Boston this September for .conf25? Get a jumpstart by arriving a few days early for Splunk ...

4 Ways the Splunk Community Helps You Prepare for .conf25

.conf25 is right around the corner, and whether you’re a first-time attendee or a seasoned Splunker, the ...

Enhance Your Splunk App Development: New Tools & Support

UCC FrameworkAdd-on Builder has been around for quite some time. It helps build Splunk apps faster, but it ...