2016-07-10 66 views
0

我試圖配置logrotate的保留時間和日誌的擴展旋轉:如何使用dateext和擴展配置logrotate的

當前的配置,文件:

在/ var/WWW /管理平臺/日誌/ production.log

是logrotated在:

在/ var/WWW /重dmine /日誌/ production.-20160710log

我期待:

/var/www/redmine/log/production-20160710.log

請參考下面的摘錄VOF在logrotate的配置文件:

貓/etc/logrotate.d/redmine

rotate 4 
    weekly 
    missingok 
    notifempty 
    compress 
    delaycompress 
    sharedscripts 
    dateext 

    /var/www/redmine/log/production.log 
    { 
      create 755 www-data www-data 
      extension log 
    } 

回答

4

我收到了!

剛剛添加了「dateformat%Y-%m-%d」。 包含「。」在格式

rotate 4 
weekly 
missingok 
notifempty 
compress 
delaycompress 
sharedscripts 
dateext 
dateformat %Y-%m-%d. 

/var/www/redmine/log/production.log 
{ 
     create 755 www-data www-data 
     extension log 
}