HAProxy Log 日志系统详解
1、实验拓扑
2、相关配置博客参照以下链接
HAProxy Balance 调度算法详解(包括 hash type)
HAProxy 的 server 参数、 stats 相关参数和 cookie 参数详解(包含其它相关参数 rspadd / rspdel / option / mode / maxconn )
3、日志系统介绍
## log global # 采用全局 log 配置
## log <address> [len <length>] <facility> [<level> [<minlevel>]] # 自定义 log
## no log # 不记录 log
## 注意:默认发往本机的日志服务器
## (1) local2.* /var/log/local2.log
## (2) $ModLoad imudp
$UDPServerRun 514
常用的一些日志命令:
## log-format <string>
## capture cookie <name> len <length>
Capture and log a cookie in the request and in the response.
## capture request header <name> len <length>
Capture and log the last occurrence of the specified request header.
## 示例: capture request header X-Forwarded-For len 15
## capture response header <name> len <length>
Capture and log the last occurrence of the specified response header.
## 示例 :capture response header Content-length len 9
## 示例: capture response header Location len 15
4、日志的前提配置参照以下博客
HAProxy 简单示例及 HAProxy_Log 的简单配置
5、HAProxy 的原始日志格式
[root@Tang ~]# tail -6 /var/log/haproxy/haproxy.log
Nov 8 11:10:03 neo haproxy[5165]: 172.16.141.99:65301 [08/Nov/2019:11:10:03.031] web websrvs/srv1 7/0/1/1/9 304 142 - - ---- 2/2/0/0/0 0/0 "GET / HTTP/1.1"
Nov 8 11:10:08 neo haproxy[5165]: 172.16.141.99:65309 [08/Nov/2019:11:10:08.916] web websrvs/srv2 1/0/