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
效果如下:
标签:-%,log,admin,logrotate,facereg,linux,home,日志 来源: https://www.cnblogs.com/ybinshi/p/15633208.html