]> granicus.if.org Git - apache/blob - docs/manual/programs/rotatelogs.html.en
* docs/manual: 'build.sh all'.
[apache] / docs / manual / programs / rotatelogs.html.en
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5               This file is generated from xml source: DO NOT EDIT
6         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7       -->
8 <title>rotatelogs - Piped logging program to rotate Apache logs - Apache HTTP Server</title>
9 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
12 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
13 <body id="manual-page"><div id="page-header">
14 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
15 <p class="apache">Apache HTTP Server Version 2.3</p>
16 <img alt="" src="../images/feather.gif" /></div>
17 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
18 <div id="path">
19 <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.3</a> &gt; <a href="./">Programs</a></div><div id="page-content"><div id="preamble"><h1>rotatelogs - Piped logging program to rotate Apache logs</h1>
20 <div class="toplang">
21 <p><span>Available Languages: </span><a href="../en/programs/rotatelogs.html" title="English">&nbsp;en&nbsp;</a> |
22 <a href="../ko/programs/rotatelogs.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p>
23 </div>
24
25      <p><code>rotatelogs</code> is a simple program for use in
26      conjunction with Apache's piped logfile feature.  It supports
27      rotation based on a time interval or maximum size of the log.
28      Rotation happens automatically during log activity, but can also
29      be triggered externally with the signals SIGHUP (checks the
30      configured rotation rules) and SIGINT (force rotate).</p>
31 </div>
32 <div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#synopsis">Synopsis</a></li>
33 <li><img alt="" src="../images/down.gif" /> <a href="#options">Options</a></li>
34 <li><img alt="" src="../images/down.gif" /> <a href="#examples">Examples</a></li>
35 <li><img alt="" src="../images/down.gif" /> <a href="#portability">Portability</a></li>
36 </ul></div>
37 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
38 <div class="section">
39 <h2><a name="synopsis" id="synopsis">Synopsis</a></h2>
40
41      <p><code><strong>rotatelogs</strong>
42      [ -<strong>l</strong> ]
43      [ -<strong>f</strong> ]
44      [ -<strong>v</strong> ]
45      <var>logfile</var>
46      <var>rotationtime</var>|<var>filesize</var>(B|K|M|G) 
47      [ <var>offset</var> ]</code></p>
48 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
49 <div class="section">
50 <h2><a name="options" id="options">Options</a></h2>
51
52 <dl>
53
54 <dt><code>-l</code></dt>
55 <dd>Causes the use of local time rather than GMT as the base for the
56 interval or for <code>strftime(3)</code> formatting with size-based 
57 rotation.  Note that using <code>-l</code> in an environment which
58 changes the GMT offset (such as for BST or DST) can lead to unpredictable
59 results!</dd>
60
61 <dt><code>-f</code></dt>
62 <dd>Causes the logfile to be opened immediately, as soon as
63 <code>rotatelogs</code> starts, instead of waiting for the
64 first logfile entry to be read (for non-busy sites, there may be
65 a substantial delay between when the server is started
66 and when the first request is handled, meaning that the
67 associated logfile does not "exist" until then, which
68 causes problems from some automated logging tools)</dd>
69
70 <dt><code>-v</code></dt>
71 <dd>Produce verbose output on STDERR. The output contains
72 the result of the configuration parsing, and all file open and
73 close actions.</dd>
74
75 <dt><code><var>logfile</var></code></dt>
76
77 <dd>The path plus basename of the logfile.  If <var>logfile</var>
78 includes any '%' characters, it is treated as a format string for
79 <code>strftime(3)</code>.  Otherwise, the suffix
80 <var>.nnnnnnnnnn</var> is automatically added and is the time in
81 seconds.  Both formats compute the start time from the beginning of
82 the current period.  For example, if a rotation time of 86400 is 
83 specified, the hour, minute, and second fields created from the
84 <code>strftime(3)</code> format will all be zero, referring to the
85 beginning of the current 24-hour period (midnight).</dd>
86
87 <dt><code><var>rotationtime</var></code></dt>
88
89 <dd>The time between log file rotations in seconds.  The rotation
90 occurs at the beginning of this interval.  For example, if the
91 rotation time is 3600, the log file will be rotated at the beginning
92 of every hour; if the rotation time is 86400, the log file will be
93 rotated every night at midnight.  (If no data is logged during an
94 interval, no file will be created.)</dd>
95
96 <dt><code><var>filesize</var>(B|K|M|G)</code></dt>
97
98 <dd>The maximum file size in followed by exactly one of the letters
99 <code>B</code> (Bytes), <code>K</code> (KBytes), <code>M</code> (MBytes)
100 or <code>G</code> (GBytes).
101 <br />
102 When time and size are specified, the size must be given after the time.
103 Rotation will occur whenever either time or size limits are reached.
104 </dd>
105
106 <dt><code><var>offset</var></code></dt>
107
108 <dd>The number of minutes offset from UTC.  If omitted, zero is
109 assumed and UTC is used.  For example, to use local time in the zone
110 UTC -5 hours, specify a value of <code>-300</code> for this argument.
111 In most cases, <code>-l</code> should be used instead of specifying
112 an offset.</dd>
113
114 </dl>
115 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
116 <div class="section">
117 <h2><a name="examples" id="examples">Examples</a></h2>
118
119 <div class="example"><p><code>
120      CustomLog "|bin/rotatelogs /var/logs/logfile 86400" common
121 </code></p></div>
122
123      <p>This creates the files /var/logs/logfile.nnnn where nnnn  is
124      the system time at which the log nominally starts (this time
125      will always be a multiple of the rotation time, so  you  can
126      synchronize cron scripts with it).  At the end of each rotation
127      time (here after 24 hours) a new log is started.</p>
128
129 <div class="example"><p><code>
130      CustomLog "|bin/rotatelogs -l /var/logs/logfile.%Y.%m.%d 86400" common
131 </code></p></div>
132
133      <p>This creates the files /var/logs/logfile.yyyy.mm.dd where
134      yyyy is the year, mm is the month, and dd is the day of the month.
135      Logging will switch to a new file every day at midnight, local time.</p>
136
137 <div class="example"><p><code>
138      CustomLog "|bin/rotatelogs /var/logs/logfile 5M" common
139 </code></p></div>
140
141      <p>This configuration will rotate the logfile whenever it reaches
142      a size of 5 megabytes.</p>
143
144 <div class="example"><p><code>
145      ErrorLog "|bin/rotatelogs /var/logs/errorlog.%Y-%m-%d-%H_%M_%S 5M"
146 </code></p></div>
147      <p>This configuration will rotate the error logfile whenever it
148      reaches a size of 5 megabytes, and the suffix to the logfile name
149      will be created of the form
150      <code>errorlog.YYYY-mm-dd-HH_MM_SS</code>.</p>
151  
152 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
153 <div class="section">
154 <h2><a name="portability" id="portability">Portability</a></h2>
155
156 <p>The following logfile format string substitutions should be
157 supported by all <code>strftime(3)</code> implementations, see
158 the <code>strftime(3)</code> man page for library-specific
159 extensions.</p>
160
161 <table class="bordered"><tr><td><code>%A</code></td><td>full weekday name (localized)</td></tr>
162 <tr class="odd"><td><code>%a</code></td><td>3-character weekday name (localized)</td></tr>
163 <tr><td><code>%B</code></td><td>full month name (localized)</td></tr>
164 <tr class="odd"><td><code>%b</code></td><td>3-character month name (localized)</td></tr>
165 <tr><td><code>%c</code></td><td>date and time (localized)</td></tr>
166 <tr class="odd"><td><code>%d</code></td><td>2-digit day of month</td></tr>
167 <tr><td><code>%H</code></td><td>2-digit hour (24 hour clock)</td></tr>
168 <tr class="odd"><td><code>%I</code></td><td>2-digit hour (12 hour clock)</td></tr>
169 <tr><td><code>%j</code></td><td>3-digit day of year</td></tr>
170 <tr class="odd"><td><code>%M</code></td><td>2-digit minute</td></tr>
171 <tr><td><code>%m</code></td><td>2-digit month</td></tr>
172 <tr class="odd"><td><code>%p</code></td><td>am/pm of 12 hour clock (localized)</td></tr>
173 <tr><td><code>%S</code></td><td>2-digit second</td></tr>
174 <tr class="odd"><td><code>%U</code></td><td>2-digit week of year 
175 (Sunday first day of week)</td></tr>
176 <tr><td><code>%W</code></td><td>2-digit week of year 
177 (Monday first day of week)</td></tr>
178 <tr class="odd"><td><code>%w</code></td><td>1-digit weekday 
179 (Sunday first day of week)</td></tr>
180 <tr><td><code>%X</code></td><td>time (localized)</td></tr>
181 <tr class="odd"><td><code>%x</code></td><td>date (localized)</td></tr>
182 <tr><td><code>%Y</code></td><td>4-digit year</td></tr>
183 <tr class="odd"><td><code>%y</code></td><td>2-digit year</td></tr>
184 <tr><td><code>%Z</code></td><td>time zone name</td></tr>
185 <tr class="odd"><td><code>%%</code></td><td>literal `%'</td></tr>
186 </table>
187
188 </div></div>
189 <div class="bottomlang">
190 <p><span>Available Languages: </span><a href="../en/programs/rotatelogs.html" title="English">&nbsp;en&nbsp;</a> |
191 <a href="../ko/programs/rotatelogs.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p>
192 </div><div id="footer">
193 <p class="apache">Copyright 2009 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
194 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>
195 </body></html>