是否可以使用Apache记录所有HTTP请求标头?

是否可以使用Apache记录所有HTTP请求标头?

问题描述:

如何将apache收到的HTTP请求标头(全部)的内容记录到日志文件中?

How to make a record into the logfile the contents of the HTTP request header (all) as received by apache?

当前我的Apache组合日志格式配置为:

Currently my apache combined log format configuration is:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{Cookie}i\"" combined

我知道可以这样做:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{Cookie}i\" \"%{heading name}i\" \"%{heading name}i\" \"%{heading name}i\"" combined

但是它不合逻辑,并且不可能知道哪个标题.

but it is not logical and it is not possible to know which headers will be.

mod_log_forensic 是您想要的,但是默认情况下,Apache安装中可能不包含/不提供它.

mod_log_forensic is what you want, but it may not be included/available with your Apache install by default.

这里是使用方法.

LoadModule log_forensic_module /usr/lib64/httpd/modules/mod_log_forensic.so 
<IfModule log_forensic_module> 
ForensicLog /var/log/httpd/forensic_log 
</IfModule>