vim /var/www/html/check.html
定义一个测试页面(check.html):
添加如下内容:
SetEnvIfRequest_URI “^/check.html” dontlog
ErrorLog"logs/error_log"
LogLevel warn
CustomLog"logs/access_log" combined env=!dontlog
apache不记录健康检查日志(check.html):
vim /etc/httpd/conf/httpd.conf
<VirtualHost *:80>
DocumentRoot "/var/www/html/"
ServerName www.aaa.com
ServerAlias www.aaa.com
SetEnvIf Request_URI "^/check.html " dontlog
ErrorLog "logs/www.aaa.com_error_log"
LogLevel warn
CustomLog "logs/www.aaa.com_access_log" haproxy env=!dontlog
</VirtualHost>
Nginx不记录健康检查日志
vim /application/nginx/conf/nginx.conf
location = /check.html {
log_not_found off;
access_log off;
}
log_not_found 是否在error_log中记录不存在的错误 默认是记录