HAProxy supports 3 log formats. Several fields are common between these formats and will be detailed in the next sections. A few of them may slightly vary with the configuration, due to indicators specific to certain options
然后我们在去看一下,关于http日志格式的详细说明,看到这句话,我们眼前一亮.
This format is enabled when "option httplog" is set on the frontend. It provides the same information as the TCP format with some HTTP - specific fields such as the request, the status code, and captures of headers and cookies.
很好,看来只需要我们简单配置 一下就可以了,我们先看一下这个选项的用法及其说明.
capture request header len
Capture and log the first occurrence of the specified request header.
May be used in sections : defaults | frontend | listen | backend