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
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="<-" alt="<-" src="../images/left.gif" /></a></div>
19 <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.3</a> > <a href="./">Programs</a></div><div id="page-content"><div id="preamble"><h1>rotatelogs - Piped logging program to rotate Apache logs</h1>
21 <p><span>Available Languages: </span><a href="../en/programs/rotatelogs.html" title="English"> en </a> |
22 <a href="../ko/programs/rotatelogs.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
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.</p>
29 <div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#synopsis">Synopsis</a></li>
30 <li><img alt="" src="../images/down.gif" /> <a href="#options">Options</a></li>
31 <li><img alt="" src="../images/down.gif" /> <a href="#examples">Examples</a></li>
32 <li><img alt="" src="../images/down.gif" /> <a href="#portability">Portability</a></li>
34 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
36 <h2><a name="synopsis" id="synopsis">Synopsis</a></h2>
38 <p><code><strong>rotatelogs</strong>
39 [ -<strong>l</strong> ]
41 <var>rotationtime</var>|<var>filesize</var>M
42 [ <var>offset</var> ]</code></p>
43 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
45 <h2><a name="options" id="options">Options</a></h2>
49 <dt><code>-l</code></dt>
50 <dd>Causes the use of local time rather than GMT as the base for the
51 interval or for <code>strftime(3)</code> formatting with size-based
52 rotation. Note that using <code>-l</code> in an environment which
53 changes the GMT offset (such as for BST or DST) can lead to unpredictable
56 <dt><code><var>logfile</var></code></dt>
58 <dd>The path plus basename of the logfile. If <var>logfile</var>
59 includes any '%' characters, it is treated as a format string for
60 <code>strftime(3)</code>. Otherwise, the suffix
61 <var>.nnnnnnnnnn</var> is automatically added and is the time in
62 seconds. Both formats compute the start time from the beginning of
63 the current period. For example, if a rotation time of 86400 is
64 specified, the hour, minute, and second fields created from the
65 <code>strftime(3)</code> format will all be zero, referring to the
66 beginning of the current 24-hour period (midnight).</dd>
68 <dt><code><var>rotationtime</var></code></dt>
70 <dd>The time between log file rotations in seconds. The rotation
71 occurs at the beginning of this interval. For example, if the
72 rotation time is 3600, the log file will be rotated at the beginning
73 of every hour; if the rotation time is 86400, the log file will be
74 rotated every night at midnight. (If no data is logged during an
75 interval, no file will be created.)</dd>
77 <dt><code><var>filesize</var>M</code></dt>
79 <dd>The maximum file size in megabytes followed by the letter
80 <code>M</code> to specify size rather than time.</dd>
82 <dt><code><var>offset</var></code></dt>
84 <dd>The number of minutes offset from UTC. If omitted, zero is
85 assumed and UTC is used. For example, to use local time in the zone
86 UTC -5 hours, specify a value of <code>-300</code> for this argument.
87 In most cases, <code>-l</code> should be used instead of specifying
91 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
93 <h2><a name="examples" id="examples">Examples</a></h2>
95 <div class="example"><p><code>
96 CustomLog "|bin/rotatelogs /var/logs/logfile 86400" common
99 <p>This creates the files /var/logs/logfile.nnnn where nnnn is
100 the system time at which the log nominally starts (this time
101 will always be a multiple of the rotation time, so you can
102 synchronize cron scripts with it). At the end of each rotation
103 time (here after 24 hours) a new log is started.</p>
105 <div class="example"><p><code>
106 CustomLog "|bin/rotatelogs -l /var/logs/logfile.%Y.%m.%d 86400" common
109 <p>This creates the files /var/logs/logfile.yyyy.mm.dd where
110 yyyy is the year, mm is the month, and dd is the day of the month.
111 Logging will switch to a new file every day at midnight, local time.</p>
113 <div class="example"><p><code>
114 CustomLog "|bin/rotatelogs /var/logs/logfile 5M" common
117 <p>This configuration will rotate the logfile whenever it reaches
118 a size of 5 megabytes.</p>
120 <div class="example"><p><code>
121 ErrorLog "|bin/rotatelogs /var/logs/errorlog.%Y-%m-%d-%H_%M_%S 5M"
123 <p>This configuration will rotate the error logfile whenever it
124 reaches a size of 5 megabytes, and the suffix to the logfile name
125 will be created of the form
126 <code>errorlog.YYYY-mm-dd-HH_MM_SS</code>.</p>
128 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
129 <div class="section">
130 <h2><a name="portability" id="portability">Portability</a></h2>
132 <p>The following logfile format string substitutions should be
133 supported by all <code>strftime(3)</code> implementations, see
134 the <code>strftime(3)</code> man page for library-specific
137 <table class="bordered"><tr><td><code>%A</code></td><td>full weekday name (localized)</td></tr>
138 <tr class="odd"><td><code>%a</code></td><td>3-character weekday name (localized)</td></tr>
139 <tr><td><code>%B</code></td><td>full month name (localized)</td></tr>
140 <tr class="odd"><td><code>%b</code></td><td>3-character month name (localized)</td></tr>
141 <tr><td><code>%c</code></td><td>date and time (localized)</td></tr>
142 <tr class="odd"><td><code>%d</code></td><td>2-digit day of month</td></tr>
143 <tr><td><code>%H</code></td><td>2-digit hour (24 hour clock)</td></tr>
144 <tr class="odd"><td><code>%I</code></td><td>2-digit hour (12 hour clock)</td></tr>
145 <tr><td><code>%j</code></td><td>3-digit day of year</td></tr>
146 <tr class="odd"><td><code>%M</code></td><td>2-digit minute</td></tr>
147 <tr><td><code>%m</code></td><td>2-digit month</td></tr>
148 <tr class="odd"><td><code>%p</code></td><td>am/pm of 12 hour clock (localized)</td></tr>
149 <tr><td><code>%S</code></td><td>2-digit second</td></tr>
150 <tr class="odd"><td><code>%U</code></td><td>2-digit week of year
151 (Sunday first day of week)</td></tr>
152 <tr><td><code>%W</code></td><td>2-digit week of year
153 (Monday first day of week)</td></tr>
154 <tr class="odd"><td><code>%w</code></td><td>1-digit weekday
155 (Sunday first day of week)</td></tr>
156 <tr><td><code>%X</code></td><td>time (localized)</td></tr>
157 <tr class="odd"><td><code>%x</code></td><td>date (localized)</td></tr>
158 <tr><td><code>%Y</code></td><td>4-digit year</td></tr>
159 <tr class="odd"><td><code>%y</code></td><td>2-digit year</td></tr>
160 <tr><td><code>%Z</code></td><td>time zone name</td></tr>
161 <tr class="odd"><td><code>%%</code></td><td>literal `%'</td></tr>
165 <div class="bottomlang">
166 <p><span>Available Languages: </span><a href="../en/programs/rotatelogs.html" title="English"> en </a> |
167 <a href="../ko/programs/rotatelogs.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
168 </div><div id="footer">
169 <p class="apache">Copyright 2008 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>
170 <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>