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.1</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-project/">Documentation</a> > <a href="../">Version 2.1</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"> en </a></p>
24 <p><code>rotatelogs</code> is a simple program for use in
25 conjunction with Apache's piped logfile feature. For example:</p>
27 <div class="example"><p><code>
28 CustomLog "|bin/rotatelogs /var/logs/logfile 86400" common
31 <p>This creates the files /var/logs/logfile.nnnn where nnnn is
32 the system time at which the log nominally starts (this time
33 will always be a multiple of the rotation time, so you can
34 synchronize cron scripts with it). At the end of each rota-
35 tion time (here after 24 hours) a new log is started.</p>
37 <div class="example"><p><code>
38 CustomLog "|bin/rotatelogs /var/logs/logfile 5M" common
41 <p>This configuration will rotate the logfile whenever it reaches
42 a size of 5 megabytes.</p>
45 <div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#synopsis">Synopsis</a></li>
46 <li><img alt="" src="../images/down.gif" /> <a href="#options">Options</a></li>
47 <li><img alt="" src="../images/down.gif" /> <a href="#portability">Portability</a></li>
49 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
51 <h2><a name="synopsis" id="synopsis">Synopsis</a></h2>
53 <p><code><strong>rotatelogs</strong> <var>logfile</var>
54 [ <var>rotationtime</var> [ <var>offset</var> ]] |
55 [ <var>filesize</var>M ]</code></p>
56 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
58 <h2><a name="options" id="options">Options</a></h2>
62 <dt><code><var>logfile</var></code></dt>
64 <dd>The path plus basename of the logfile. If <var>logfile</var>
65 includes any '%' characters, it is treated as a format string for
66 <code>strftime(3)</code>. Otherwise, the suffix
67 <var>.nnnnnnnnnn</var> is automatically added and is the time in
68 seconds. Both formats compute the start time from the beginning of
69 the current period.</dd>
71 <dt><code><var>rotationtime</var></code></dt>
73 <dd>The time between log file rotations in seconds.</dd>
75 <dt><code><var>offset</var></code></dt>
77 <dd>The number of minutes offset from UTC. If omitted, zero is
78 assumed and UTC is used. For example, to use local time in the zone
79 UTC -5 hours, specify a value of <code>-300</code> for this argument.</dd>
81 <dt><code><var>filesize</var>M</code></dt>
83 <dd>The maximum file size in megabytes followed by the letter
84 <code>M</code> to specify size rather than time. Use this parameter
85 in place of both rotationtime and offset.</dd>
87 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
89 <h2><a name="portability" id="portability">Portability</a></h2>
91 <p>The following logfile format string substitutions should be
92 supported by all <code>strftime(3)</code> implementations, see
93 the <code>strftime(3)</code> man page for library-specific
96 <table class="bordered"><tr><td><code>%A</code></td><td>full weekday name (localized)</td></tr>
97 <tr class="odd"><td><code>%a</code></td><td>3-character weekday name (localized)</td></tr>
98 <tr><td><code>%B</code></td><td>full month name (localized)</td></tr>
99 <tr class="odd"><td><code>%b</code></td><td>3-character month name (localized)</td></tr>
100 <tr><td><code>%c</code></td><td>date and time (localized)</td></tr>
101 <tr class="odd"><td><code>%d</code></td><td>2-digit day of month</td></tr>
102 <tr><td><code>%H</code></td><td>2-digit hour (24 hour clock)</td></tr>
103 <tr class="odd"><td><code>%I</code></td><td>2-digit hour (12 hour clock)</td></tr>
104 <tr><td><code>%j</code></td><td>3-digit day of year</td></tr>
105 <tr class="odd"><td><code>%M</code></td><td>2-digit minute</td></tr>
106 <tr><td><code>%m</code></td><td>2-digit month</td></tr>
107 <tr class="odd"><td><code>%p</code></td><td>am/pm of 12 hour clock (localized)</td></tr>
108 <tr><td><code>%S</code></td><td>2-digit second</td></tr>
109 <tr class="odd"><td><code>%U</code></td><td>2-digit week of year
110 (Sunday first day of week)</td></tr>
111 <tr><td><code>%W</code></td><td>2-digit week of year
112 (Monday first day of week)</td></tr>
113 <tr class="odd"><td><code>%w</code></td><td>1-digit weekday
114 (Sunday first day of week)</td></tr>
115 <tr><td><code>%X</code></td><td>time (localized)</td></tr>
116 <tr class="odd"><td><code>%x</code></td><td>date (localized)</td></tr>
117 <tr><td><code>%Y</code></td><td>4-digit year</td></tr>
118 <tr class="odd"><td><code>%y</code></td><td>2-digit year</td></tr>
119 <tr><td><code>%Z</code></td><td>time zone name</td></tr>
120 <tr class="odd"><td><code>%%</code></td><td>literal `%'</td></tr>
124 <div class="bottomlang">
125 <p><span>Available Languages: </span><a href="../en/programs/rotatelogs.html"> en </a></p>
126 </div><div id="footer">
127 <p class="apache">Maintained by the <a href="http://httpd.apache.org/docs-project/">Apache HTTP Server Documentation Project</a></p>
128 <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>