В настоящее время у меня есть около 3,5 ГБ файлов журнала поверх
/var/log/atop/
Мне не нужно столько данных журнала.
Файлы там старше 28 дней назад.
Я не могу найти способ настроить atop
ограничение журнала / квота / возраст.
Как уменьшить использование дискового пространства?
Используя это наконечник, Я редактировал
/etc/init.d/atop
Поскольку на странице руководства написано «четыре недели», там явно была эта команда:
find $LOGPATH -name 'atop_*' -mtime +28 -exec rm {} \;
Итак, файлы 28-дневной давности будут храниться ...
Я изменил это на
find $LOGPATH -name 'atop_*' -mtime +1 -exec rm {} \;
И выполнил эту команду:
sudo service atop _cron
Сейчас логи только за вчерашний день, это то, что мне нужно.
Добавление ответа для моей версии (также есть на страницах руководства):
Ubuntu: 17.04
$ поверх -V
Версия: 2.2.6
Скрипт находится: /usr/share/atop/atop.daily
Я упал до 7 дней логов.
38c38
< ( (sleep 3; find $LOGPATH -name 'atop_*' -mtime +28 -exec rm {} \;)& )
---
> ( (sleep 3; find $LOGPATH -name 'atop_*' -mtime +7 -exec rm {} \;)& )
Всегда читайте man
страница. Всегда.
Если бы вы сделали это, вы бы увидели это:
When atop is installed, the script atop.daily is stored in the /etc/atop directory.
This scripts takes care that atop is activated every day at midnight to
write compressed binary data to the file /var/log/atop/atop_YYYYMMDD
with an interval of 10 minutes. Furthermore the script removes all raw
files which are older than four weeks. The script is activated via the cron
daemon using the file /etc/cron.d/atop with the contents
0 0 * * * root /etc/atop/atop.daily
When the RPM `psacct` is installed, the process accounting is automatically
restarted via the logrotate mechanism. The file
/etc/logrotate.d/psaccs_atop takes care that atop is finished just before
the rotation of the process accounting file and the file
/etc/logrotate.d/psaccu_atop takes care that atop is restarted again after
the rotation. When the RPM `psacct' is not installed, these logrotate-files
have no effect.