Web服务器中的Logrotation

问题描述

我已经在我的一台Web服务器上设置了logrotation,但是它不能满足我在/etc/logrotate.d/customfile中的自定义要求。以下是/ etc目录中的logrotate.conf,logrotate.d / customfile和cron.daily。如何使其适用于customfile中的配置详细信息?

/etc/logrotate.conf

# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# use date as a suffix of the rotated file
dateext

# uncomment this if you want your log files compressed
compress

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp and btmp -- we'll rotate them here
/var/log/wtmp {
    monthly
    create 0664 root utmp
        minsize 1M
    rotate 1
}

/var/log/btmp {
    missingok
    monthly
    create 0600 root utmp
    rotate 1
}

/etc/logrotate.d/customfile

"/app/logs/website.com/error_log" "/app/logs/website.com/access_log" {
   daily
   size 500M
   missingok
   rotate 30
   compress
   delaycompress
   nomail
   create 644 admin admin
   sharedscripts
   postrotate
      if [ -f /app/instance/sites/website.com/run/httpd.pid ]; then
         su - admin -c /app/instance/sites/website.com/gracefulApache.sh > /dev/null
      fi
   endscript
   }

/etc/cron.daily/logrotate

#!/bin/sh

/usr/sbin/logrotate -s /var/lib/logrotate/logrotate.status /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
    /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit 0

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...