[20200330]sar报表保存时间.txt
--//今天想修改sar报表的保存时间,以前版本缺省时间7天有点短,需要保存更长的时间,便于事后分析问题。
--//今天在centos 7上配置,发现以前配置的一个小问题。
# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
# rpm -qcf $(which sar)
/etc/cron.d/sysstat
/etc/sysconfig/sysstat
/etc/sysconfig/sysstat.ioconf
--//配置文件就这些。打开/etc/sysconfig/sysstat发现:
# cat /etc/sysconfig/sysstat
# How long to keep log files (in days).
# If value is greater than 28, then log files are kept in
# multiple directories, one for each month.
HISTORY=28
# Compress (using gzip or bzip2) sa and sar files older than (in days):
COMPRESSAFTER=31
# Parameters for the system activity data collector (see sadc manual page)
# which are used for the generation of log files.
SADC_OPTIONS="-S DISK"
# Compression program to use.
ZIP="bzip2"
--//可以发现当前版本已经设置到28天,但是你可以发现注解存在说明大于28天要建立多个目录。每个目录一个月。
--//我看了我以前设置:
HISTORY=31
--//发现实际上
# ls -l /var/log/sa/sar*|wc
27 216 1863
--//也就是以前的测试即使设置31,实际上最大也就是28天。测试看看大于28天会出现什么情况。
--//修改如下:
# cat /etc/sysconfig/sysstat
# sysstat-10.1.5 configuration file.
# How long to keep log files (in days).
# If value is greater than 28, then log files are kept in
# multiple directories, one for each month.
HISTORY=50
# Compress (using gzip or bzip2) sa and sar files older than (in days):
COMPRESSAFTER=41
# Parameters for the system activity data collector (see sadc manual page)
# which are used for the generation of log files.
SADC_OPTIONS="-S DISK"
# Compression program to use.
ZIP="bzip2"
--//等一段时间在观察看看是是怎样的情况。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-2683271/ ,如需转载,请注明出处,否则将追究法律责任。