Incorrect number of arguments
Usage: /usr/bin/rotatelogs [-vlfDtTec] [-L linkname] [-p prog] [-n number] <logfile> {<rotation time in seconds>|<rotation size>(B|K|M|G)} [offset minutes from UTC]
Add this:
TransferLog "|/usr/bin/rotatelogs /some/where 86400"
or
TransferLog "|/usr/bin/rotatelogs /some/where 5M"
to httpd.conf. By default, the generated name will be
<logfile>.nnnn where nnnn is the system time at which the log
nominally starts (N.B. if using a rotation time, the time will
always be a multiple of the rotation time, so you can synchronize
cron scripts with it). If <logfile> contains strftime conversion
specifications, those will be used instead. At the end of each
rotation time or when the file size is reached a new log is
started.
Options:
-v Verbose operation. Messages are written to stderr.
-l Base rotation on local time instead of UTC.
-L path Create hard link from current log to specified path.
-p prog Run specified program after opening a new log file. See below.
-f Force opening of log on program start.
-D Create parent directories of log file.
-t Truncate logfile instead of rotating, tail friendly.
-T Truncate logfiles opened for rotation, but not the initial logfile.
-e Echo log to stdout for further processing.
-c Create log even if it is empty.
-n num Rotate file by adding suffixes '.1', '.2', ..., '.num'.
The program for '-p' is invoked as "[prog] <curfile> [<prevfile>]"
where <curfile> is the filename of the newly opened logfile, and
<prevfile>, if given, is the filename of the previously used logfile.
Options (11)
| Option | Description | Source |
|---|
-v | Produce verbose output on STDERR. | help + man |
-l | Causes the use of local time rather than GMT as the base for the interval or for strftime(3) formatting with size-based rotation. | help + man |
-L path | Create hard link from current log to specified path. | help + man |
-p prog | If given, rotatelogs will execute the specified program every time a new log file is opened. | help + man |
-f | Causes the logfile to be opened immediately, as soon as rotatelogs starts, instead of waiting for the first logfile entry to be read (for non-busy sites, there may be a substantial delay between when… | help + man |
-D | Creates the parent directories of the path that the log file will be placed in if they do not already exist. | help + man |
-t | Causes the logfile to be truncated instead of rotated. | help + man |
-T | Truncate logfiles opened for rotation, but not the initial logfile. | help + man |
-e | Echo log to stdout for further processing. | help + man |
-c | Create log file for each interval, even if empty. | help + man |
-n num | Rotate file by adding suffixes '.1', '.2', ..., '.num'. | help + man |
Examples (6) from the manual page, untested
CustomLog "|bin/rotatelogs /var/log/logfile 86400" commonCustomLog "|bin/rotatelogs -l /var/log/logfile.%Y.%m.%d 86400" common
This creates the files /var/log/logfile.nnnn where nnnn is the system time at which the log nominally starts (this time will always be a multiple of the rotation time, so you can synchronize cron…CustomLog "|bin/rotatelogs /var/log/logfile 5M" common
This creates the files /var/log/logfile.yyyy.mm.dd where yyyy is the year, mm is the month, and dd is the day of the month.ErrorLog "|bin/rotatelogs /var/log/errorlog.%Y-%m-%d-%H_%M_%S 5M"
This configuration will rotate the logfile whenever it reaches a size of 5 megabytes.CustomLog "|bin/rotatelogs -t /var/log/logfile 86400" common
This configuration will rotate the error logfile whenever it reaches a size of 5 megabytes, and the suffix to the logfile name will be created of the form errorlog.YYYY-mm-dd-HH_MM_SS.CustomLog "|bin/rotatelogs -T /var/log/logfile.%d 86400" common
This creates the file /var/log/logfile, truncating the file at startup and then truncating the file once per day.
Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.