linux之logrotate日志切割

案例:

定制配置文件/etc/logrotate.d/java

/home/admin/server_home/facereg/*.log{
daily
su root root
rotate 30
copytruncate
nodelaycompress
compress
ifempty
missingok
create 0700 admin admin
dateext
dateformat .%Y-%m-%d-%H-%s
olddir /home/admin/server_home/facereg
}
#######################################
/home/admin/server_home/facereg/logs/*.log{
daily
su root root
rotate 30
copytruncate
nodelaycompress
compress
ifempty
missingok
create 0700 admin admin
dateext
dateformat .%Y-%m-%d-%H-%s
olddir /home/admin/server_home/facereg
}

/etc/logrotate.d/redis

/home/admin/cluster/redis/log/*.log{
daily
su root root
rotate 30
copytruncate
nodelaycompress
compress
ifempty
missingok
create 0700 admin admin
dateext
dateformat .%Y-%m-%d-%H-%s
olddir /home/admin/cluster/redis/log
}

 

定制定时任务

00 00 * * * /usr/bin/logrotate -v -f /etc/logrotate.d/java
00 00 * * * /usr/bin/logrotate -v -f /etc/logrotate.d/redis

效果如下:

 

上一篇:访问dubbo-admin访问报404的错误


下一篇:安装ceph (快速) 步骤三: Ceph 客户端