I have just enabled sysstat on one of my servers (Ubuntu 12.04), I have noticed it is logging all to
/var/log/sysstat/sa04
/var/log/sysstat/sa05
/var/log/sysstat/sar04
How can I change the sysstat logging path to another folder on another disk?
Looked through the configs couldn't find anything :(
I am not sure about ubuntu but in Fedora node,here is the scenario
[root@test ~]# cat /etc/cron.d/sysstat
Run system activity accounting tool every 10 minutes
*/10 * * * * root /usr/lib64/sa/sa1 1 1
Generate a daily summary of process accounting at 23:53
53 23 * * * root /usr/lib64/sa/sa2 -A
If you open any of these scripts
less /usr/lib64/sa/sa1
SYSCONFIG_DIR=/etc/sysconfig
[ -r ${SYSCONFIG_DIR}/sysstat ] && . ${SYSCONFIG_DIR}/sysstat
if [ ${HISTORY} -gt 28 ]
then
Check DDIR variable,so look like its hardcoded here,so if you want to give any customize/change path you can add here.
@user1901030 provided an answer that requires you to edit the script. Workable, but if the script gets upgraded, your changes will be overwritten.
Rather, I recommend you perform a bindmount on top of /var/log/sysstat. Edits in /etc/fstab are almost never touched by package updates.
The command to do a bindmount would be:
When it's mounted, enter the
mount
command to get all the fstab incantations.In current versions of
sar
, this is a configurable setting, and can be updated in/etc/sysstat/sysstat
by setting theSA_DIR
option.Since the activity recording scripts run in
cron
, they should automatically pick up the change the next time they execute.