我've recently upgraded to haproxy 1.6.3, and I' ve为所有HTTP / TCP请求提供了一个默认的 log-format
指令,如下所示:
defaults
log-format %hr\ %ST\ %B\ %Ts
log global
mode http
option dontlognull
retries 3
option redispatch
option http-server-close
maxconn 2000
timeout client 3600s
timeout server 3600s
timeout connect 5s
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
但是,当我重新启动服务器并开始写入日志条目时,它们是使用haproxy的默认HTTP / TCP日志格式编写的:
Feb 8 14:55:41 localhost haproxy [6770]:host - - [08 / Feb / 2016:21:55:41 0000]“POST /path/to/service/1.0 HTTP / 1.1”200 841“”“ “43359 499”前端“”后端“”服务器“0 0 0 22 22 ---- 0 0 0 0 0 0 0”“”“2月8日14:54:05 localhost haproxy [6771]:主机:端口[08 /Feb/2016:14:54:05.469]前端后端1/0/4 147 - 0/0/0/0/0 0/0
为什么我的 log-format
被忽略了?重启时我没有收到任何警告或警报 .
1 回答
即使我在默认部分中配置了
log-format
指令,也有一些前端设置了option tcplog
和option httplog clf
,它们覆盖了我配置的日志格式 .haproxy documentation在这里有点误导: