Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2461217
  • 博文数量: 392
  • 博客积分: 7040
  • 博客等级: 少将
  • 技术积分: 4138
  • 用 户 组: 普通用户
  • 注册时间: 2009-06-17 13:03
个人简介

范德萨发而为

文章分类

全部博文(392)

文章存档

2017年(5)

2016年(19)

2015年(34)

2014年(14)

2013年(47)

2012年(40)

2011年(51)

2010年(137)

2009年(45)

分类: 系统运维

2011-07-07 11:06:24

这两天,产品那边有个需求

牵涉到lighttpd的access log

(需要在access log里加上refer信息,同时还有些特定的url不要记到access log里)

于是哈哈就翻了翻lighttpd的文档(关于access log的)

顺便贴到这里:

 

Accesslog Module: mod_accesslog
Author: Jan Kneschke
Date: 2004-11-03
Revision: 1.2

Abstract

The accesslog module …

CLF like by default, flexible like apache

accesslog.use-syslog

send the accesslog to syslog

Default: disabled

accesslog.filename

name of the file where the accesslog should be written too if syslog is not used.

if the name starts with a ‘|’ the rest of the name is taken as the name of a process which will be spawn and will get the output

e.g.:

accesslog.filename = "/var/log/lighttpd.log" $HTTP["host"] == "mail.example.org" { accesslog.filename = "|/usr/bin/cronolog" }

Default: disabled

accesslog.format

the format of the logfile

Option Description
%% a percent sign
%h name or address of remote-host
%l ident name (not supported)
%u authenticated user
%t timestamp for the request-start
%r request-line
%s status code
%b bytes sent for the body
%i HTTP-header field
%a remote address
%A local address
%B same as %b
%C cookie field (not supported)
%D time used in ms (not supported)
%e environment (not supported)
%f phyiscal filename
%H request protocol (HTTP/1.0, …)
%m request method (GET, POST, …)
%n (not supported)
%o
%p server port
%P (not supported)
%q query string
%T time used in seconds
%U request URL
%v server-name
%V (not supported)
%X connection status
%I bytes incomming
%O bytes outgoing

If %s is written %>s or % are ignored. They are support for compat with apache.

%i and %o expect the name of the field which should be written in curly brackets.

e.g.:

accesslog.format = "%h %l %u %t \"%r\" %b %>s \"%{User-Agent}i\" \"%{Referer}i\""

Default: CLF compatible output

The accesslog module provides a special way to log content from the application in a accesslog file. It can be used to log the session id into a logfile.

If you want to log it into the accesslog just specify the field-name within a %{…}o like

accesslog.format = "%h %l %u %t \"%r\" %b %>s \"%{User-Agent}i\" \"%{Referer}i\" \"%{X-LIGHTTPD-SID}o\""

The prefix X-LIGHTTPD- is special as every response header starting with this prefix is assumed to be special for lighttpd and won’t be sent out to the client.

An example the use this functionality is provided below:

 

最后我加的配置文件是这么几句: $HTTP["url"] !~ "/(xxxxxx.ini|xxxxx.php)$" {

        accesslog.format = "%h %l %u %t \"%r\" %b %>s \"%{Referer}i\""

        accesslog.filename          = "/www/logs/access_log"

}

阅读(3413) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~