First, Introduction
Rotatelogs is Apache's own pipeline log program, can be perfect to achieve the rotation of the log function.
Second, the grammar
Usage:rotatelogs [-v] [-l] [-l linkname] [-P prog] [-f] [-t] [-e] [-c] <logfile> {<rotation Time inchSeconds>|<rotation size> (b| k| m|G)} [offset minutes from Utc]add This:transferlog"|rotatelogs/some/where 86400"or Transferlog"|rotatelogs/some/where 5M"To httpd.conf. By default, the generated name would be<logfile>.nnnn where nnnn is the system TimeAtwhichThe lognominally starts (n.b.ifUsing a rotation Time, the Timewillalways be a multiple of the rotation Time, so you can synchronizecron scripts with it). If<logfile>contains strftime conversionspecifications, those would be used instead. at the end of Eachrotation Timeor when thefilesize is reached a new log isstarted. Options:-v Verbose operation. Messages is written to stderr. -L Base rotation on local Timeinstead of UTC. -L path Create hard link from the current log to specified path. -P prog Run specified program after opening a new logfile. See below. -f Force Opening of Log on program start. -T Truncate logfile instead of rotating,Tailfriendly. -e Echo log to stdout forfurther processing. -C Create Log evenifit is empty. The program is invoked as"[prog] <curfile> [<prevfile>]"where<curfile>is the filename of the newly opened logfile, and<prevfile>,ifGiven, is the filename of the previously used logfile.
Third, examples
http://Www.lao8.org/article_1444/fangwenrizhi_antian
Apache rotatelogs Command