GNUmakefile: NEWS depends on .manifest
[clogger.git] / README
blob5688aa91159ef2eb34cec901d9d092344d9c602e
1 = Clogger - configurable request logging for Rack
3 == DESCRIPTION
5 Clogger is Rack middleware for logging HTTP requests.  The log format
6 is customizable so you can specify exactly which fields to log.
8 == FEATURES
10 * highly customizable with easy-to-read nginx-like log format variables.
12 * pre-defines Apache Common Log Format, Apache Combined Log Format and
13   Rack::CommonLogger (as distributed by Rack 1.0) formats.
14   See Clogger::Format for the predefined formats.
16 * Untrusted values are escaped (all HTTP headers, request URI components)
17   to make life easier for HTTP log parsers. The following bytes are escaped:
19     ' (single quote)
20     " (double quote)
21     all bytes in the range of \x00-\x1F
23 * multi-instance capable and reentrant.  You can use Clogger in a
24   multi-threaded server, and even multiple Cloggers logging to
25   different locations and different formats in the same process.
27 == SYNOPSIS
29 Clogger may be loaded as Rack middleware in your config.ru:
31   require "clogger"
32   use Clogger,
33       :format => Clogger::Format::Combined,
34       :logger => File.open("/path/to/log", "ab")
35   run YourApplication.new
37 If you're using Rails 2.3.x or later, in your config/environment.rb
38 somewhere inside the "Rails::Initializer.run do |config|" block:
40   config.middleware.use 'Clogger',
41       :format => Clogger::Format::Combined,
42       :logger => File.open("/path/to/log", "ab")
44 == VARIABLES
46 * $http_* - HTTP request headers (e.g. $http_user_agent)
47 * $sent_http_* - HTTP response headers (e.g. $sent_http_content_length)
48 * $content_length - HTTP request body size
49   ($http_content_length is not allowed by Rack)
50 * $content_type - HTTP request content type
51   ($http_content_type is not allowed by Rack)
52 * $cookie_* - HTTP request cookie (e.g. $cookie_session_id)
53   Rack::Request#cookies must have been used by the underlying application
54   to parse the cookies into a hash.
55 * $request_method - the HTTP request method (e.g. GET, POST, HEAD, ...)
56 * $path_info - path component requested (e.g. /index.html)
57 * $query_string - request query string (not including leading "?")
58 * $request_uri - the URI requested ($path_info?$query_string)
59 * $request - the first line of the HTTP request
60   ($request_method $request_uri $http_version)
61 * $request_time, $request_time{PRECISION} - time taken for request
62   (including response body iteration).  PRECISION defaults to 3
63   (milliseconds) if not specified but may be specified anywhere from
64   0(seconds) to 6(microseconds).
65 * $time_local, $time_local{FORMAT} - current local time, FORMAT defaults to
66   "%d/%b/%Y:%H:%M:%S %z" but accepts any strftime(3)-compatible format
67 * $time_utc, $time_utc{FORMAT} - like $time_local, except with UTC
68 * $usec - current time in seconds.microseconds since the Epoch
69 * $msec - current time in seconds.milliseconds since the Epoch
70 * $body_bytes_sent - bytes in the response body (Apache: %B)
71 * $response_length - body_bytes_sent, except "-" instead of "0" (Apache: %b)
72 * $remote_user - HTTP-authenticated user
73 * $remote_addr - IP of the requesting client socket
74 * $status - three-digit HTTP status code (e.g. 200, 404, 302)
75 * $ip - X-Forwarded-For request header if available, $remote_addr if not
76 * $pid - process ID of the current process
77 * $e{Thread.current} - Thread processing the request
78 * $e{Actor.current} - Actor processing the request (Revactor or Rubinius)
80 == REQUIREMENTS
82 * Ruby, Rack
84 == DEVELOPMENT
86 The latest development happens in git and is published to the following:
88    git://git.bogomips.org/clogger.git
89    git://repo.or.cz/clogger.git
91 You may also browse and download snapshot tarballs:
93 * http://git.bogomips.org/cgit/clogger.git (cgit)
94 * http://repo.or.cz/w/clogger.git (gitweb)
96 The mailing list (see below) is central for coordination and
97 development.  Patches should always be sent inline
98 (git format-patch -M + git send-email) so we can reply to them inline.
100 == CONTACT
102 All feedback (bug reports, user/development dicussion, patches, pull
103 requests) go to the mailing list.
105 * mailto:clogger@librelist.com
107 Do not send HTML mail or attachments.  Do not top post.
109 Homepage: http://clogger.rubyforge.org/
111 == INSTALL
113 For Rubygems users:
115   gem install clogger
117 If you do not use Rubygems, you may also use setup.rb from the tarballs
118 on the Rubyforge project page:
120 * http://rubyforge.org/frs/?group_id=8896
122 There is an optional C extension that should be compatible with MRI
123 1.8/1.9.  The extensions should automatically be disabled for users of
124 other Ruby implementations, but be sure to let us know if that's not the
125 case.  No pre-built binaries are currently distributed, let us know if
126 you're interested in helping with the release/support effort.
128 == LICENSE
130 Copyright (C) 2009 Eric Wong and contributors.
132 Clogger is free software; you can redistribute it and/or modify it under
133 the terms of the GNU Lesser General Public License as published by the
134 Free Software Foundation, version 3.0.
136 Clogger is distributed in the hope that it will be useful, but WITHOUT ANY
137 WARRANTY; without even the implied warranty of MERCHANTABILITY or
138 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
139 License in the COPYING file for more details.
141 You should have received a copy of the GNU Lesser General Public License
142 along with Clogger; if not, write to the Free Software Foundation, Inc.,
143 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301