更新时间:2020-06-23 14:41:12
Apache 日志格式和目录通常在配置文件 /etc/apache2/httpd.conf中。
Apache日志配置文件中定义了两种打印格式,分别为combined格式和common格式。
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b"
CustomLog "/var/log/apache2/access_log" combined
字段说明
字段格式 | 含义 |
---|---|
%a | remote_ip |
%A | local_ip |
%B | size |
%b | length |
%D | time_taken_ms |
%h | remote_host |
%H | protocol |
%l | ident |
%m | method |
%p | port |
%P | pid |
%q | url_query |
%r | request |
%s | status |
%>s | status |
%t | time |
%T | time_taken |
%u | remote_user |
%U | url_stem |
%v | server_name |
%V | canonical_name |
%I | bytes_received |
%O | bytes_sent |
%{User-Agent}i | user_agent |
%{Referer}i | referer |