设为首页 收藏本站
查看: 424|回复: 0

[经验分享] apache log格式设置

[复制链接]

尚未签到

发表于 2017-1-3 06:15:34 | 显示全部楼层 |阅读模式
  LogFormat 可以用的格式串有(转自:http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#formats):
Format StringDescription%%The percent sign%aRemote IP-address%ALocal IP-address%BSize of response in bytes, excluding HTTP headers.%bSize of response in bytes, excluding HTTP headers. In CLF format, i.e. a '-' rather than a 0 when no bytes are sent.%{Foobar}CThe contents of cookie Foobar in the request sent to the server. Only version 0 cookies are fully supported.%DThe time taken to serve the request, in microseconds.%{FOOBAR}eThe contents of the environment variable FOOBAR%fFilename%hRemote host%HThe request protocol%{Foobar}iThe 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.%kNumber 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.%lRemote logname (from identd, if supplied). This will return a dash unless mod_ident is present and IdentityCheck is set On.%mThe request method%{Foobar}nThe contents of note Foobar from another module.%{Foobar}oThe contents of Foobar: header line(s) in the reply.%pThe canonical port of the server serving the request%{format}pThe 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.%PThe process ID of the child that serviced the request.%{format}PThe 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.%qThe query string (prepended with a ? if a query string exists, otherwise an empty string)%rFirst line of request%RThe handler generating the response (if any).%sStatus. For requests that got internally redirected, this is the status of the *original* request --- %>s for the last.%tTime the request was received (standard english format)%{format}tThe time, in the form given by format, which should be in strftime(3) format. (potentially localized)%TThe time taken to serve the request, in seconds.%uRemote user (from auth; may be bogus if return status (%s) is 401)%UThe URL path requested, not including any query string.%vThe canonical ServerName of the server serving the request.%VThe server name according to the UseCanonicalName setting.%XConnection 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.)
%IBytes received, including request and headers, cannot be zero. You need to enable mod_logio to use this.%OBytes 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]"

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-322878-1-1.html 上篇帖子: apache能缓存数据说明 下篇帖子: Apache MINA (1) 简介
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表