Apache日志 默认是不分割的,整个存放在一起,不利于统计和查错,使用cronolog日志分割工具能有效解决问题
cronolog is a simple filter program that reads log file entries from standard input and writes each entry to the output file specified by a filename template and the current date and time. When the expanded filename changes, the current file is closed and a new one opened. cronolog is intended to be used in conjunction with a Web server, such as Apache, to split the access log into daily or monthly logs.
1.安装cronolog //Log file rotator
sudo yum install -y cronolog
2.修改虚拟主机配置
CustomLog “|/usr/sbin/cronolog /var/log/httpd/talk_access.%Y%m%d.log combined
ErrorLog “|/usr/sbin/cronolog /var/log/httpd/talk_error.%Y%m%d.log
3.重载apache