-
Notifications
You must be signed in to change notification settings - Fork 0
/
envylogger.html
124 lines (73 loc) · 4.71 KB
/
envylogger.html
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
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>envylogger usage</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:[email protected]" />
</head>
<body>
<h1>envylogger - flexible log rotation in perl</h1>
<ul id="index">
<li><a href="#NAME">NAME</a></li>
<li><a href="#SYNOPSIS">SYNOPSIS</a></li>
<li><a href="#DESCRIPTION">DESCRIPTION</a></li>
<li><a href="#USAGE-AND-EXAMPLES">USAGE AND EXAMPLES</a>
<ul>
<li><a href="#EXAMPLE">EXAMPLE:</a></li>
</ul>
</li>
<li><a href="#OPTIONS">OPTIONS</a></li>
<li><a href="#SEE-ALSO">SEE ALSO</a></li>
<li><a href="#BUGS">BUGS</a></li>
<li><a href="#AUTHORS">AUTHORS</a></li>
</ul>
<h1 id="NAME">NAME</h1>
<p>envylogger - flexible log rotation in perl</p>
<h1 id="SYNOPSIS">SYNOPSIS</h1>
<p>envylogger [OPTIONS]... [LOGDIR]</p>
<h1 id="DESCRIPTION">DESCRIPTION</h1>
<p>envylogger is a redesigned variant of vlogger, to allow custom named VirtualHost folders each containing a logs folder to place logs into. envylogger takes piped output from Apache, splits off the first field, and writes the logs to logfiles into the logs sub-folder of subdirectories. It uses a filehandle cache to avoid resource limitations. It will start a new logfile at the beginning of a new day, and optionally start new files when a certain filesize is reached. It can maintain a symlink to the most recent log for easy access. For Apache 2.4 and up, the same first-field parsing can be enabled, to be used in ErrorLog directives, by specifying an ErrorLogFormat.</p>
<h1 id="USAGE-AND-EXAMPLES">USAGE AND EXAMPLES</h1>
<p>To start using envylogger, set the environment variable ENVY_NAME inside your vhosts' configs to the dirname of your vhost, that contains the 'logs' directory:</p>
<h2 id="EXAMPLE">EXAMPLE:</h2>
<ul>
<li><p><b>If the full path to your logs dir is:</b> <code>/var/www/my_envy_dir/logs/</code></p>
</li>
<li><p><b>then set the variable so:</b> <code>SetEnv ENVY_NAME my_envy_dir</code></p>
</li>
<li><p><b>Next, you need to add the "%{ENVY_NAME}e" to the first part of your LogFormat:</b></p>
<p><code>LogFormat "%{ENVY_NAME}e %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" envy_combined</code></p>
</li>
<li><p><b>Then call it from a customlog:</b></p>
<p><code>CustomLog "| /usr/local/sbin/envylogger -t access.apache.%Y.%m.%d.log -u www-data -g www-data /var/www" envy_combined</code></p>
</li>
<li><p><b>For Apache 2.4+, the same host parsing can be enabled, first you need to add a custom ErrorLogFormat, starting with "%{ENVY_NAME}e" :</b></p>
<p><code>ErrorLogFormat "%{ENVY_NAME}e [%{u}t] [%-m:%l] [pid %P] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i"</code></p>
</li>
<li><p><b>NOTE: the above format should only used in conjuction with piping ErrorLog to envylogger:</b></p>
<p><code>ErrorLog "| /usr/local/sbin/envylogger -e -t error.apache.%Y.%m.%d.log -u www-data -g www-data /var/www"</code></p>
</li>
</ul>
<h1 id="OPTIONS">OPTIONS</h1>
<p>Options are given in short format on the command line.</p>
<p>-a Do not autoflush files. This may improve performance but may break logfile analyzers that depend on full entries in the logs.</p>
<p>-e ErrorLog mode. In this mode, the host parsing is disabled, and the file is written out using the template under the specified LOGDIR.</p>
<p>-n Disables rotation. This option disables rotation altogether.</p>
<p>-f MAXFILES Maximum number of filehandles to keep open. Defaults to 100. Setting this value too high may result in the system running out of file descriptors. Setting it too low may affect performance.</p>
<p>-u UID Change user to UID when running as root.</p>
<p>-g GID Change group to GID when running as root.</p>
<p>-t TEMPLATE Filename template using Date::Format codes. Default envy format is "access.apache.%Y.%m.%d.log", or "error.apache.%Y.%m.%d.log". When using the -r option, the default becomes "%m%d%Y-%T-access.log" or "%m%d%Y-%T-error.log".</p>
<p>-s SYMLINK Specifies the name of a symlink to the current file.</p>
<p>-r SIZE Rotate files when they reach SIZE. SIZE is given in bytes.</p>
<p>-h Displays help.</p>
<p>-v Prints version information.</p>
<h1 id="SEE-ALSO">SEE ALSO</h1>
<p>vlogger(1), cronolog(1), httplog(1)</p>
<h1 id="BUGS">BUGS</h1>
<p>None, yet.</p>
<h1 id="AUTHORS">AUTHORS</h1>
<p>Gergely Nagy <[email protected]></p>
<p>WWW: <a href="https://github.com/gnanet/envylogger">https://github.com/gnanet/envylogger</a></p>
</body>
</html>