首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使“`atop`”创建更少的日志文件?

如何使“`atop`”创建更少的日志文件?
EN

Server Fault用户
提问于 2016-05-08 23:18:26
回答 3查看 14.3K关注 0票数 9

当前,我有大约3.5GB的顶级日志文件

/var/log/atop/

我不需要那么多日志数据。

那里的档案早在28天前就有了。

我找不到一种方法来配置atop日志限制/配额/年龄。

如何降低磁盘空间的使用率?

EN

回答 3

Server Fault用户

发布于 2016-05-08 23:26:47

始终阅读man页面。一直都是。

通过运行man atop来做到这一点

如果你这么做的话,你就会看到:

代码语言:javascript
复制
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.
票数 3
EN

Server Fault用户

发布于 2022-05-27 06:56:01

此解决方案适用于Ubuntu以及其他系统:

打开配置文件/etc/default/atop

它会看起来像这样

代码语言:javascript
复制
# /etc/default/atop
# see man atoprc for more possibilities to configure atop execution

LOGOPTS="-R"
LOGINTERVAL=10
LOGGENERATIONS=28
LOGPATH=/var/log/atop

LOGGENERATIONS是将存储的历史记录天数(配置值由/usr/share/atop/atop.day读取,它将删除旧的日志文件)

您可以将LOGGENERATIONS更改为较小的天数。

票数 0
EN

Server Fault用户

发布于 2022-10-11 07:47:36

所有给定的答案在某个时候都是正确的,尽管atop似乎多次更改了配置文件的位置。正如@EEAA所建议的,请检查man atop以获得特定版本的配置位置。

对于我来说,在v2.7.1之上,配置位于/etc/default/atop下面,并提供了所有必要的信息。

票数 0
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/775540

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档