distribution项目一致往app.log中写入日志
日积月累,形成很大的一个量,导致查看日志不方便
现使用logrotate进行日志切割,每天切割压缩,保留60天
操作步骤留作记录,参数详情不做解释,可网上查询
ssh root@xxxxxxxxxxxx
cd /etc/logrotate.d
rz 文件
distribution
/home/work/workdir/apps/distribution/logs/app.log {
daily
rotate 60
copytruncate
compress
missingok
notifempty
dateext
create 0664 work work
}
cd ..
logrotate -vf /etc/logrotate.d/distribution
切割后截图
解压日志
gunzip app.log-20201214.gz