在httpd.conf中找到这两项
ErrorLog logs/error_log
CustomLog logs/access_log common
替换成
ErrorLog "| /usr/sbin/rotatelogs /var/log/httpd/%Y_%m_%d_error_log 86400 480"
CustomLog "| /usr/sbin/rotatelogs /var/log/httpd/%Y_%m_%d_access_log 86400 480" common
rotatelogs是apache的一个日志分割的一个软件,centos里路径是/usr/sbin里面,替换之前查找一下这个文件的路径 find / -name rotatelogs