4

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 :(

3 Answers 3

2

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

    CURRENTDIR=`date +%Y%m`
    DATE=`date +%d`
    CURRENTFILE=sa${DATE}
    DDIR=/var/log/sa  <-----------------------------
    cd ${DDIR} || exit 1

Check DDIR variable,so look like its hardcoded here,so if you want to give any customize/change path you can add here.

2

@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:

mount -o bind /path/on/different/drive /var/log/sysstat

When it's mounted, enter the mount command to get all the fstab incantations.

1

In current versions of sar, this is a configurable setting, and can be updated in /etc/sysstat/sysstat by setting the SA_DIR option.

Since the activity recording scripts run in cron, they should automatically pick up the change the next time they execute.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.