LogFormat 可以用的格式串有(转自:http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#formats):
%% |
The percent sign |
%a |
Remote IP-address |
%A |
Local IP-address |
%B |
Size of response in bytes, excluding HTTP headers. |
%b |
Size of response in bytes, excluding HTTP headers. In CLF format, i.e. a '- ' rather than a 0 when no bytes are sent. |
%{Foobar}C |
The contents of cookie Foobar in the request sent to the server. Only version 0 cookies are fully supported. |
%D |
The time taken to serve the request, in microseconds. |
%{FOOBAR}e |
The contents of the environment variable FOOBAR
|
%f |
Filename |
%h |
Remote host |
%H |
The request protocol |
%{Foobar}i |
The contents of Foobar: header line(s) in the request sent to the server. Changes made by other modules (e.g. mod_headers ) affect this. If you're interested in what the request header was prior to when most modules would have modified it, use mod_setenvif to copy the header into an internal environment variable and log that value with the %{VARNAME}e described above. |
%k |
Number of keepalive requests handled on this connection. Interesting if KeepAlive is being used, so that, for example, a '1' means the first keepalive request after the initial one, '2' the second, etc...; otherwise this is always 0 (indicating the initial request). Available in versions 2.2.11 and later. |
%l |
Remote logname (from identd, if supplied). This will return a dash unless mod_ident is present and IdentityCheck is set On . |
%m |
The request method |
%{Foobar}n |
The contents of note Foobar from another module. |
%{Foobar}o |
The contents of Foobar: header line(s) in the reply. |
%p |
The canonical port of the server serving the request |
%{format}p |
The canonical port of the server serving the request or the server's actual port or the client's actual port. Valid formats are canonical , local , orremote . |
%P |
The process ID of the child that serviced the request. |
%{format}P |
The process ID or thread id of the child that serviced the request. Valid formats are pid , tid , and hextid . hextid requires APR 1.2.0 or higher. |
%q |
The query string (prepended with a ? if a query string exists, otherwise an empty string) |
%r |
First line of request |
%R |
The handler generating the response (if any). |
%s |
Status. For requests that got internally redirected, this is the status of the *original* request --- %>s for the last. |
%t |
Time the request was received (standard english format) |
%{format}t |
The time, in the form given by format, which should be in strftime(3) format. (potentially localized) |
%T |
The time taken to serve the request, in seconds. |
%u |
Remote user (from auth; may be bogus if return status (%s ) is 401) |
%U |
The URL path requested, not including any query string. |
%v |
The canonical ServerName of the server serving the request. |
%V |
The server name according to the UseCanonicalName setting. |
%X |
Connection status when response is completed:
X = |
connection aborted before the response completed. |
+ = |
connection may be kept alive after the response is sent. |
- = |
connection will be closed after the response is sent. |
(This directive was %c in late versions of Apache 1.3, but this conflicted with the historical ssl %{var}c syntax.)
|
%I |
Bytes received, including request and headers, cannot be zero. You need to enable mod_logio to use this. |
%O |
Bytes sent, including headers, cannot be zero. You need to enable mod_logio to use this. |
日志格式示例:
"%t [%r] %>s %h %a %v %D %b [%{User-Agent}i] [%{Referer}i --> %U]"
分享到:
相关推荐
Apache Log4j 2 (apache-log4j-2.17.1-bin.zip)是对 Log4j 的升级,它比其前身 Log4j 1.x 提供了重大改进,并提供了 Logback 中可用的许多改进,同时修复了 Logback 架构中的一些固有问题。修复了安全漏洞 CVE-...
Log4j2 的配置文件可以是 properties 文件或 YAML 文件,需要将 log4j2.formatMsgNoLookups 设置为 true,以禁用消息查找功能。 例如,在 properties 文件中添加以下配置: ``` #log4j2 log4j2.formatMsgNoLookups=...
Apache Log4j2 是一个广泛使用的Java日志框架,它为开发者提供了强大的日志记录功能。然而,在2021年12月初,一个严重的安全漏洞(CVE-2021-44228)被公开,这个漏洞被称为"Log4Shell",允许攻击者通过注入恶意的...
Log4j具有高度可配置性,支持多种输出格式(如控制台、文件、网络客户端等)和日志级别(如DEBUG、INFO、WARN、ERROR等),能够满足不同场景下的需求。 #### 二、书籍概述 《Pro Apache Log4j 第二版》是由Samudra...
Apache Log4j 2 (apache-log4j-2.17.1-bin.tar.gz)是对 Log4j 的升级,它比其前身 Log4j 1.x 提供了重大改进,并提供了 Logback 中可用的许多改进,同时修复了 Logback 架构中的一些固有问题。修复了安全漏洞 CVE-...
Apache Log4j是Java平台上的一个著名日志记录框架,广泛应用于各种Java应用程序中,包括服务器、Web应用、企业级软件等。Log4j 1.2.16是该框架的一个版本,提供了丰富的日志功能,允许开发者灵活地控制日志信息的...
- **配置文件**:详细介绍如何通过XML、properties或JSON格式的配置文件来设置Log4j的行为,提供多种示例帮助理解。 - **MDC(Mapped Diagnostic Context)**:探讨MDC的用途,即在日志消息中添加额外的上下文信息,...
赠送jar包:apache-log4j-extras-1.2.17.jar; 赠送原API文档:apache-log4j-extras-1.2.17-javadoc.jar; 赠送Maven依赖信息文件:apache-log4j-extras-1.2.17.pom; 包含翻译后的API文档:apache-log4j-extras-...
Apache Log4j_1.2.17 完整依赖包,在jdk1.8.201中测试通过。使用教程https://www.tutorialspoint.com/springmvc/springmvc_log4j.htm
标题中的"ApacheLog4j_Win.zip"暗示这是一个针对Windows操作系统的Apache Log4j漏洞验证工具。这意味着该压缩包可能包含一系列用于检测和测试Log4j 2安全漏洞的工具和脚本,特别是针对JNDI(Java Naming and ...
- `log4j.appender.stdout.layout`和`log4j.appender.R.layout`设置了日志的输出格式,例如日期、级别、线程名、类名、方法名、行号等。 - `log4j.logger`系列行用于指定特定包或类的日志级别,如`DEBUG`、`ERROR`...
Apache Log4j 2.0 发布第 4 个 Beta 版本,包括的新特性有: o Added Log4j 2 to SLF4J adapter. o LOG4J2-131: Add SMTPAppender. Thanks to Scott Severtson. o Added hostName and contextName to property ...
通常,这会涉及到创建一个配置文件(如log4j2.xml或log4j2.json),并设置环境变量或类路径来指向这个配置文件。在Java代码中,你可以通过调用`org.apache.logging.log4j.LogManager.getLogger()`获取一个Logger实例...
此漏洞源于 Log4j 的 JNDI(Java Naming and Directory Interface)功能,当日志中包含特定格式的字符串(如 `${jndi:ldap://恶意服务器地址}`)时,Log4j 会尝试与远程 LDAP 服务器进行交互,从而加载并执行远程...
Apache Log4j 是一个广泛使用的Java日志框架,它的核心功能是记录应用程序中的事件和错误信息,便于跟踪问题、分析性能以及调试。Log4j 提供了一种灵活、高效的日志记录机制,允许开发者定制日志输出的方式、位置和...
Apache Log4j 2 源代码( apache-log4j-2.17.1-src.tar.gz) 是对 Log4j 的升级,它比其前身 Log4j 1.x 提供了重大改进,并提供了 Logback 中可用的许多改进,同时修复了 Logback 架构中的一些固有问题。修复了安全...
Apache Log4j 2.17.2 是一个重要的安全更新版本,主要针对先前发现的严重漏洞进行修复。Log4j 是 Apache 组织开发的一个广泛使用的Java日志框架,它允许开发者在应用程序中实现灵活的日志记录。此次发布的binaries...
Apache Log4j 2存在远程代码执行漏洞处置指南 及期检测工具
Apache Log4j 2 源代码( apache-log4j-2.17.1-src.zip) 是对 Log4j 的升级,它比其前身 Log4j 1.x 提供了重大改进,并提供了 Logback 中可用的许多改进,同时修复了 Logback 架构中的一些固有问题。修复了安全漏洞...
解决Apache Log4j 远程代码执行漏洞log4j2部分jar,包含log4j-1.2-api-2.15.0.jar,log4j-api-2.15.0.jar,log4j-core-2.15.0.jar,log4j-to-slf4j-2.15.0.jar