1ROTATELOGS(8)                     rotatelogs                     ROTATELOGS(8)
2
3
4

NAME

6       rotatelogs - Piped logging program to rotate Apache logs
7
8

SYNOPSIS

10       rotatelogs [ -l ] [ -f ] logfile rotationtime|filesizeM [ offset ]
11
12
13

SUMMARY

15       rotatelogs  is  a  simple  program for use in conjunction with Apache's
16       piped logfile feature. It supports rotation based on a time interval or
17       maximum size of the log.
18
19
20

OPTIONS

22       -l     Causes the use of local time rather than GMT as the base for the
23              interval or for strftime(3) formatting with size-based rotation.
24              Note  that using -l in an environment which changes the GMT off‐
25              set (such as for BST or DST) can lead to unpredictable results!
26
27       -f     Causes the logfile to be opened immediately, as soon as rotatel‐
28              ogs starts, instead of waiting for the first logfile entry to be
29              read (for non-busy sites,  there  may  be  a  substantial  delay
30              between when the server is started and when the first request is
31              handled, meaning that the associated logfile  does  not  "exist"
32              until  then,  which  causes problems from some automated logging
33              tools). Available in version 2.2.9 and later.
34
35       logfile
36              The path plus basename of the logfile. If logfile  includes  any
37              '%'  characters,  it  is  treated  as  a format string for strf‐
38              time(3). Otherwise,  the  suffix  .nnnnnnnnnn  is  automatically
39              added and is the time in seconds. Both formats compute the start
40              time from the beginning of the current period. For example, if a
41              rotation  time of 86400 is specified, the hour, minute, and sec‐
42              ond fields created from the strftime(3) format will all be zero,
43              referring  to  the beginning of the current 24-hour period (mid‐
44              night).
45
46       rotationtime
47              The time between log file rotations  in  seconds.  The  rotation
48              occurs  at  the  beginning of this interval. For example, if the
49              rotation time is 3600, the log  file  will  be  rotated  at  the
50              beginning  of every hour; if the rotation time is 86400, the log
51              file will be rotated every night at midnight.  (If  no  data  is
52              logged during an interval, no file will be created.)
53
54       filesizeM
55              The  maximum  file size in megabytes followed by the letter M to
56              specify size rather than time.
57
58       offset The number of minutes offset  from  UTC.  If  omitted,  zero  is
59              assumed  and  UTC is used. For example, to use local time in the
60              zone UTC -5 hours, specify a value of -300 for this argument. In
61              most cases, -l should be used instead of specifying an offset.
62
63

EXAMPLES

65            CustomLog "|bin/rotatelogs /var/logs/logfile 86400" common
66
67
68
69       This  creates the files /var/logs/logfile.nnnn where nnnn is the system
70       time at which the log nominally starts (this time will always be a mul‐
71       tiple  of  the  rotation time, so you can synchronize cron scripts with
72       it). At the end of each rotation time (here after 24 hours) a  new  log
73       is started.
74
75
76            CustomLog "|bin/rotatelogs -l /var/logs/logfile.%Y.%m.%d 86400" common
77
78
79
80       This  creates  the files /var/logs/logfile.yyyy.mm.dd where yyyy is the
81       year, mm is the month, and dd is the day of  the  month.  Logging  will
82       switch to a new file every day at midnight, local time.
83
84
85            CustomLog "|bin/rotatelogs /var/logs/logfile 5M" common
86
87
88
89       This  configuration  will rotate the logfile whenever it reaches a size
90       of 5 megabytes.
91
92
93            ErrorLog "|bin/rotatelogs /var/logs/errorlog.%Y-%m-%d-%H_%M_%S 5M"
94
95
96
97       This configuration will rotate the error logfile whenever it reaches  a
98       size of 5 megabytes, and the suffix to the logfile name will be created
99       of the form errorlog.YYYY-mm-dd-HH_MM_SS.
100
101

PORTABILITY

103       The following logfile format string substitutions should  be  supported
104       by  all  strftime(3)  implementations, see the strftime(3) man page for
105       library-specific extensions.
106
107
108       · %A - full weekday name (localized)
109
110
111       · %a - 3-character weekday name (localized)
112
113
114       · %B - full month name (localized)
115
116
117       · %b - 3-character month name (localized)
118
119
120       · %c - date and time (localized)
121
122
123       · %d - 2-digit day of month
124
125
126       · %H - 2-digit hour (24 hour clock)
127
128
129       · %I - 2-digit hour (12 hour clock)
130
131
132       · %j - 3-digit day of year
133
134
135       · %M - 2-digit minute
136
137
138       · %m - 2-digit month
139
140
141       · %p - am/pm of 12 hour clock (localized)
142
143
144       · %S - 2-digit second
145
146
147       · %U - 2-digit week of year (Sunday first day of week)
148
149
150       · %W - 2-digit week of year (Monday first day of week)
151
152
153       · %w - 1-digit weekday (Sunday first day of week)
154
155
156       · %X - time (localized)
157
158
159       · %x - date (localized)
160
161
162       · %Y - 4-digit year
163
164
165       · %y - 2-digit year
166
167
168       · %Z - time zone name
169
170
171       · %% - literal `%'
172
173
174
175
176Apache HTTP Server                2008-05-10                     ROTATELOGS(8)
Impressum