summaryrefslogtreecommitdiff
path: root/doc/accesslog.txt
blob: 36584cf7a7ec1130ce1c6c9f22a1931e0dfd9ac7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
=========
Accesslog
=========

---------------------
Module: mod_accesslog
---------------------

:Author: Jan Kneschke
:Date: $Date: 2004/11/03 22:26:05 $
:Revision: $Revision: 1.2 $

:abstract:
  The accesslog module ... 
  
.. meta::
  :keywords: lighttpd, accesslog, CLF
  
.. contents:: Table of Contents

Description
===========

CLF like by default, flexible like apache

Options
=======

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     `response header`_
  %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 %<s the < and the > 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

Response Header
---------------

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: ::

  <?php
  
  session_start();
  
  header("X-LIGHTTPD-SID: ".session_id());
  
  ?>