這是我關於超級用戶的第一個問題,所以放輕鬆!
我嘗試透過將 /etc/sysconfig/sysstat 檔案更新為以下內容來修剪伺服器的 /var/log/sa/* 日誌:
# 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=7
# Compress (using gzip or bzip2) sa and sar files older than (in days):
COMPRESSAFTER=1
# 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="gzip"
以前,我的設定檔會保留 28 天的文件,並每 31 天壓縮一次(從不)。進行上述更新後,我運行了:
service sysstat restart
無濟於事 - 我還注意到預設的 cron 作業位於:
/etc/cron.d/sysstat
其中內容如下:
# Run system activity accounting tool every 10 minutes
*/10 * * * * root /usr/lib64/sa/sa1 1 1
# 0 * * * * root /usr/lib64/sa/sa1 600 6 &
# Generate a daily summary of process accounting at 23:53
53 23 * * * root /usr/lib64/sa/sa2 -A
我需要手動運行上述內容還是等到明天?或者,它與我的重新啟動和 cron 作業無關,這意味著我只需手動刪除不需要的 saDD/sarDD 日誌?
乾杯
答案1
只需手動運行即可在 5 分鐘內回答我自己的問題: /usr/lib64/sa/sa2 -A
以 root 身分執行上述 cron 作業。
我會留下我的問題/答案,因為它可能會在將來幫助別人。