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

Onitlikesonic
  • 1,161
  • 4
  • 15
  • 24

3 Answers3

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.

Prashant Lakhera
  • 683
  • 1
  • 9
  • 25
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.

pepoluan
  • 4,918
  • 3
  • 43
  • 71
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.

ncoghlan
  • 153
  • 1
  • 1
  • 7