apache作为web服务器,弱长时间运行,会导致日志文件累计过大,进而影响问题定位效率,需要修改apache的httpd.conf配置文件,实现按天记录日志。
在配置文件中找到,并注释:
ErrorLog logs/error_log CustomLog logs/access_log common
添加新的配置命令:
CustomLog "| /usr/local/apache/bin/rotatelogs /usr/local/apache/logs/%Y_%m_%d_access_log 86400 480" common ErrorLog "| /usr/local/apache/bin/rotatelogs /usr/local/apache/logs/%Y_%m_%d_error_log 86400 480"