LOGROTATE(8)             System Administrator’s Manual            LOGROTATE(8)




NAME

       logrotate - rotates, compresses, and mails system logs

        转储, 压缩, 邮件发送系统日志.


SYNOPSIS

摘要

       logrotate [-dv] [-f|--force] [-s|--state file] config_file ..


DESCRIPTION

描述

       logrotate  is  designed to ease administration of systems that generate

       large numbers of log files.  It allows automatic rotation, compression,

       removal, and mailing of log files.  Each log file may be handled daily,

       weekly, monthly, or when it grows too large.

       logrotate 被设计用于缓解系统管理所产生的大量日志的情况. 它可以自动转储,压缩

       移除, 或者用邮件发送日志文件. 每个日志文件可以设置为每天/每周/每月,或者增大

       到一定程序时,进行处理.


       Normally, logrotate is run as a daily cron job.  It will not  modify  a

       log  multiple  times  in  one  day unless the criterion for that log is

       based on the log’s size and logrotate is being run multiple times  each

       day, or unless the -f or --force option is used.

       一般的, logrotate 会被放是每日定时任务里. 同一个日志文件不会在一天内修改多次,

       除非切割是基于日志大小且一天内logrotate会运行多次, 或者使用了 -f 或 --force

       选项.


       Any number of config files may be given on the command line. Later con-

       fig files may override the options given in earlier files, so the order

       in which the logrotate config files are listed is important.  Normally,

       a single config file which includes any other config  files  which  are

       needed  should  be  used.  See below for more information on how to use

       the include directive to accomplish this.  If a directory is  given  on

       the  command  line,  every  file  in that directory is used as a config

       file.

       命令行上可以使用任意数量的配置文件.后面的配置文件的选项会覆盖前面的配置文件的

      选项值, 所以logrotate列出的配置文件的顺序是很重要的. 一般的, 会使用一个配置

      文件包含其它需要的配置文件. 见下面有关更多的使用include指令完成这一功能的信息.

      如果在命令行上给出了一个目录,目录下的所有文件都会当作配置文件来使用.


       If no command line arguments are given, logrotate  will  print  version

       and  copyright  information,  along with a short usage summary.  If any

       errors occur while rotating logs, logrotate  will  exit  with  non-zero

       status.

       如果在命令行上没有给出参数, logrotate会打印出版本信息,以及简短的使用摘要.

       在转储日志的过程中如果出现任何错误, logrotate 会以非0值 退出.



OPTIONS

选项

       -d, --debug

              Turns  on  debug mode and implies -v.  In debug mode, no changes

              will be made to the logs or to the logrotate state file.

              打开日志调试模式,并使用-v选项. 在调试模式下, 不会处理日志文件和修改

              状态文件.



       -f, --force

              Tells logrotate to force the rotation, even if it doesn’t  think

              this  is  necessary.   Sometimes this is useful after adding new

              entries to a logrotate config file, or if  old  log  files  have

              been removed by hand, as the new files will be created, and log-

              ging will continue correctly.

              使用强制转储, 即使没有达到设置的条件. 这在配置文件增加新的条目, 或者

              手动移除旧的日志文件时非常有用, 这时会创建新日志文件, 日志功能继续正常

              工作.



       -m, --mail <command>

              Tells logrotate which command to use  when  mailing  logs.  This

              command  should accept two arguments: 1) the subject of the mes-

              sage, and 2) the recipient. The command must then read a message

              on standard input and mail it to the recipient. The default mail

              command is /bin/mail -s.

              设置用邮件发送日志时使用的命令.这个命令需要接受两个参数,1)消息主题, 

              2)接收者. 命令需要从标准输入读入消息,并发送给接收者. 默认的邮件命令

              是 /bin/mail -s



       -s, --state <statefile>

              Tells logrotate to use an alternate state file.  This is  useful

              if  logrotate  is being run as a different user for various sets

              of log files.  The default state file is /var/lib/logrotate.sta-

              tus.

使用指定的状态文件, 这对于不同的用户设置不同的日志文件来说是非常有用. 

默认的状态文件是 /var/lib/logrotate.status


       --usage

              Prints a short usage message.

              打印简短的使用信息



       --?, --help

              -Prints help message.

              打印帮助信息



       -v, --verbose

              Turns on verbose mode.

              打开详细输出模式.



CONFIGURATION FILE

配置文件

       logrotate  reads  everything  about the log files it should be handling

       from the series of configuration files specified on the  command  line.

       Each configuration file can set global options (local definitions over-

       ride global ones, and later  definitions  override  earlier  ones)  and

       specify  logfiles  to  rotate.  

       logrotate 会读取命令行上给出的一系列配置文件中指定的可以处理的一切日志文件.

       每个配置文件可以设置全局选项(本地定义的选项会覆盖全局的,后面定义的选项会覆盖前

       面的)和特别指定要转储的日志文件.

       

       A  simple configuration file looks like this:

       一个简单的配置文件示例:


       # sample logrotate configuration file

       compress


       /var/log/messages {

           rotate 5

           weekly

           postrotate

               /usr/bin/killall -HUP syslogd

           endscript

       }


       "/var/log/httpd/access.log" /var/log/httpd/error.log {

           rotate 5

           mail www@my.org

           size 100k

           sharedscripts

           postrotate

               /usr/bin/killall -HUP httpd

           endscript

       }


       /var/log/news/* {

           monthly

           rotate 2

           olddir /var/log/news/old

           missingok

           postrotate

               kill -HUP ‘cat /var/run/inn.pid‘

           endscript

           nocompress

       }



       The first few lines set global options; in the example, logs  are  com-

       pressed after they are rotated.  Note that comments may appear anywhere

       in the config file as long as the first non-whitespace character on the

       line is a #.

       第一行设置了全局选项;在这个示例中,日志在转储后会被压缩. 注意注释可以出现在配置

       文件中的任何位置, 只要一行的第一个非空白字符是#


       The next section of the config files defined how to handle the log file

       /var/log/messages. The log will go through five weekly rotations before

       being  removed. After the log file has been rotated (but before the old

       version of the log has been compressed), the command /sbin/killall -HUP

       syslogd will be executed.

       配置文件的下一段定义如何处理 /var/log/messages. 日志会经过5周的转储,然后删除.

       在日志完成转储后(但会在旧的日志完成压缩前),会执行/sbin/killall -HUP syslogd 命令


       The     next     section    defines    the    parameters    for    both

       /var/log/httpd/access.log  and  /var/log/httpd/error.log.    They   are

       rotated whenever it grows over 100k in size, and the old logs files are

       mailed (uncompressed) to www@my.org after going  through  5  rotations,

       rather  than being removed. The sharedscripts means that the postrotate

       script will only be run once (after the old logs have been compressed),

       not  once  for  each  log which is rotated. Note that the double quotes

       around the first filename at  the  beginning  of  this  section  allows

       logrotate  to rotate logs with spaces in the name. Normal shell quoting

       rules apply, with ’, ", and \ characters supported.

       接下来的部分同时为/var/log/httpd/access.log 和 /var/log/httpd/error.log

       定义了参数. 只要这两个日志文件大小超过100K, 日志就会被转储, 在经过5次转储后,

       旧的日志文件会邮寄(不压缩)到www@my.org,而不是删除.sharedscripts表示了

       postrotate脚本只会运行一次(在旧的日志文件完成压缩之后),而不是每个日志文件完成

       转储后就执行一次.注意在这一部分,第一个文件名用双引号引起来,允许logrotate转储

       名称中有空格的日志文件.一般引用规则,支持用 ' " \ 


       The last section defines  the  parameters  for  all  of  the  files  in

       /var/log/news.  Each  file is rotated on a monthly basis.  This is con-

       sidered a single rotation directive and if errors occur for  more  than

       one file, the log files are not compressed.

       最后一部分为/var/log/news下所有的日志文件定义了参数. 每个文件每个月转储一次.

       这被认为是单一的一个转储指令,并且如果有超过1个文件出错, 日志文件就不进行压缩


       Please  use  wildcards  with caution.  If you specify *, logrotate will

       rotate all files, including previously rotated ones.  A way around this

       is  to  use  the  olddir  directive  or  a more exact wildcard (such as

       *.log).

       请谨慎使用通配符. 如果指定了*, logrotate会转储所有的文件,包括以前转储的文件.

       解决这个问题的一个方法是,使用 olddir指令 或者一个更精确的通配符(比如*.log)


       Here is more information on the directives which may be included  in  a

       logrotate configuration file:

       下面有可以使用在logrotate配置文件中的指令的更多信息:



       compress

              Old  versions  of  log  files  are  compressed  with  gzip(1) by

              default. See also nocompress.

              旧的日志文件会使用gzip进行压缩,又见nocompress



       compresscmd

              Specifies which command to  use  to  compress  log  files.   The

              default is gzip.  See also compress.

              使用指定的命令进行压缩, 默认的是gzip, 又见compress



       uncompresscmd

              Specifies  which  command  to  use to uncompress log files.  The

              default is gunzip.

              使用指定命令来解压日志文件, 默认的是gunzip



       compressext

              Specifies which extension to use on compressed logfiles, if com-

              pression is enabled.  The default follows that of the configured

              compression command.

              指定压缩文件的扩展名,如果有指定压缩选项的话.一般会紧跟着compression

              命令.



       compressoptions

              Command line options may be passed to the  compression  program,

              if  one  is  in use.  The default, for gzip(1), is "-9" (maximum

              compression).

              命令行选项会传送给压缩命令,如果有使用的话. 默认gzip会使用-9(最大压缩率) 



       copy   Make a copy of the log file, but don’t change  the  original  at

              all.   This option can be used, for instance, to make a snapshot

              of the current log file, or when some  other  utility  needs  to

              truncate  or parse the file.  When this option is used, the cre-

              ate option will have no effect, as the old  log  file  stays  in

              place.

              复制一份日志文件,但是原来的不做修改. 此选项可用于,例如,给当前的日志文件

              做一个快照, 或者其它的程序需要截断或者解析这个文件.当使用这个选项时,

              create选项将会失效, 因为旧的日志文件没有改变.



       copytruncate

              Truncate  the  original log file in place after creating a copy,

              instead of moving the old log file and optionally creating a new

              one.   It  can be used when some program cannot be told to close

              its logfile and thus might continue writing (appending)  to  the

              previous log file forever.  Note that there is a very small time

              slice between copying the file and truncating it, so  some  log-

              ging  data  might be lost.  When this option is used, the create

              option will have no effect, as the old log file stays in  place.

              创建一个副本后, 截断原始日志文件,而不是移动的旧的日志文件,然后再创建

              一个新的日志文件.可用于一些程序不能接收到消息需要关闭旧的日志文件而因此

              继续往旧的日志文件中写日志.注意在复制文件到截断文件之间有一个小的时间片

              所以日志文件有可能丢失.如何使用了这个选项,create选项将会失效.因为旧的

              日志文件没有改变.



       create mode owner group, create owner group

              Immediately after rotation (before the postrotate script is run)

              the log file is created (with the same name as the log file just

              rotated).   mode  specifies  the  mode for the log file in octal

              (the same as chmod(2)), owner specifies the user name  who  will

              own  the  log  file,  and group specifies the group the log file

              will belong to. Any of the log file attributes may  be  omitted,

              in  which  case  those  attributes for the new file will use the

              same values as the original log file for the omitted attributes.

              This option can be disabled using the nocreate option.

              转储后立即(在postrotate脚本运行前)创建日志文件(使用和转储同样的文件名)

              mode位置以八进制的方式(如同chmod(2)), 指定文件模式, ower位置指定了将

              拥有这个文件的用户名,而group位置指定了这个文件属于哪个用户组.所有的

              文件属性是可以省略的,在这种情况下,新文件的属性将使用同原始文件的属性

              做为默认的属性, 这个选项可以使用nocreate选项来禁用.



       daily  Log files are rotated every day.

        日志文件每天进行转储.



       dateext

              Archive  old versions of log files adding a daily extension like

              YYYYMMDD instead of simply adding a number. The extension may be

              configured using the dateformat option.

              旧的日志文件会增加一个像YYYYMMDD的扩展,而不是简单的增加一个数字.

              扩展可以使用dateformat选项.

              



       dateformat format_string

              Specify  the extension for dateext using the notation similar to

              strftime(3) function. Only  %Y  %m  %d  and  %s  specifiers  are

              allowed.  The default value is -%Y%m%d. Note that also the character

              separating log name from the  extension  is  part  of  the

              dateformat  string.  The  system  clock must be set past Sep 9th

              2001 for %s to work correctly.  Note that the datestamps  gener-

              ated  by this format must be lexically sortable (i.e., first the

              year, then the month then the day. e.g., 2001/12/01 is  ok,  but

              01/12/2001 is not, since 01/11/2002 would sort lower while it is

              later).  This is because when using the rotate option, logrotate

              sorts all rotated filenames to find out which logfiles are older

              and should be removed.

              指定日期扩展名使用类似strftime函数的格式.只允许使用%Y %m %d %s. 默认是

              -%Y%m%d. 值得注意的是用来分隔日志名的扩展也是dataformat的一部分,系统时间

              必须设置为超过2001年9月以使%s可以正常工作.要注意设置的日戳格式必须要可分类的

              (例如, 年月日 2001/12/01 是可以的, 但是01/12/2001 不可以的, 因为01/11/2001

              会在排序的时候比较靠后). 因为在当使用rotate选项时, logrotate 对所有的转储

              文件名进行排序,会将最旧的文件删除掉.



       delaycompress

              Postpone compression of the previous log file to the next  rota-

              tion  cycle.  This only has effect when used in combination with

              compress.  It can be used when some program cannot  be  told  to

              close  its logfile and thus might continue writing to the previ-

              ous log file for some time.

              在下一轮的转储时间再将当前的日志文件进行压缩. 仅生效于与compress组合

              使用时. 有时可使用与一些程序不可以被告知需要关闭日志文件而导致可能结继续

              向之前的日志文件中写入.



       extension ext

              Log files with ext extension can keep it after the rotation.  If

              compression  is  used,  the compression extension (normally .gz)

              appears  after  ext.  For  example  you  have  a  logfile  named

              mylog.foo  and  want  to  rotate it to mylog.1.foo.gz instead of

              mylog.foo.1.gz.

              在日志转储后,可使用ext当作文件扩展名. 如果使用了comopression选项

              压缩的扩展名(一般是.gz)会出现在ext后. 比如你有一个叫做mylog.foo的

              日志文件, 并且希望转储后的名字是mylog.1.foo.gz,而不是mylog.foo.1.gz



       ifempty

              Rotate the  log  file  even  if  it  is  empty,  overriding  the

              notifempty option (ifempty is the default).

              转储日志文件,即使它是空的,覆盖noifempty选项(默认是开启的)



       include file_or_directory

              Reads the file given as an argument as if it was included inline

              where the include directive appears. If a  directory  is  given,

              most of the files in that directory are read in alphabetic order

              before processing of the  including  file  continues.  The  only

              files  which  are  ignored are files which are not regular files

              (such as directories and named pipes) and files whose names  end

              with  one  of the taboo extensions, as specified by the tabooext

              directive.  The include directive may not appear  inside  a  log

              file definition.

              读取给定的文件作为参数, 如果他内联着include指令出现的地方???

              如果给出的是一个目录, 那个目录中的大多数文件将会在处理includeing之前

              按字母排序的读取.非普通文件将被忽略(如目录和管道文件),还有由tabooext

              指定所指定的后缀的普通文件.include指定不一定出现在一个日志文件的定义中.



       mail address

              When a log is rotated out-of-existence, it is mailed to address.

              If no mail should be generated by a particular log,  the  nomail

              directive may be used.

              当一个日志文件不存在时进行的转储, 它将会被邮寄到address. 如果特殊的日志

              不需要邮寄, 可以使用nomail选项.



       mailfirst

              When using the mail command, mail the just-rotated file, instead

              of the about-to-expire file.

              如何使用了mail选项,将邮寄刚转储的文件,而不是即将过期的文件.



       maillast

              When using the mail  command,  mail  the  about-to-expire  file,

              instead of the just-rotated file (this is the default).

              如果使用了mail选项, 邮寄即将过期的文件,而不是刚转储的文件(默认选项)



       maxage count

              Remove  rotated  logs  older  than <count> days. The age is only

              checked if the logfile is to be rotated. The files are mailed to

              the configured address if maillast and mail are configured.

              删除晚于某一天数的转储日志.只检查转储的日志文件.如果有设置mail

              和maillast, 日志将会被邮寄给address

              



       minsize size

              Log files are rotated when they grow bigger than size bytes, but

              not before the  additionally  specified  time  interval  (daily,

              weekly, monthly, or yearly).  The related size option is similar

              except that it is mutually  exclusive  with  the  time  interval

              options,  and  it  causes log files to be rotated without regard

              for the last rotation time.  When minsize is used, both the size

              and timestamp of a log file are considered.

              只有当日志文件大小size时,但不是特别指定的时间间隔(每日/每周/每月/每年)

              相关的size选项会排斥时间间隔选项, 这会导致 日志文件会在不考虑最后一次

              转储时间进行转储.当使用了minisize, 文件大小和时间戳同时会被考虑.



       missingok

              If  the log file is missing, go on to the next one without issu-

              ing an error message. See also nomissingok.

              当日志文件不存在的时候, 继续处理一下个,而不打印出错误信息,又见nomissingok



       monthly

              Log files are rotated the first time logrotate is run in a month

              (this is normally on the first day of the month).

              当月中第一次运行logrotate时,进行转储(通常是在一个月的第一天)



       nocompress

              Old versions of log files are not compressed. See also compress.

              旧的日志文件不进行压缩,又见compress



       nocopy Do not copy the original log file and leave it in place.   (this

              overrides the copy option).

              不复制原始文件,并保留它(覆盖copy选项)



       nocopytruncate

              Do  not truncate the original log file in place after creating a

              copy (this overrides the copytruncate option).

              在创建备份后不截断原始日志文件(将覆盖copytruncate选项



       nocreate

              New log  files  are  not  created  (this  overrides  the  create

              option).

              不创建新的日志文件(覆盖create选项)



       nodelaycompress

              Do not postpone compression of the previous log file to the next

              rotation cycle (this overrides the delaycompress option).

              在当前周期中压缩的日志文件,而不是下一周期(覆盖delaycompress)



       nodateext

              Do not archive  old versions of log files  with  date  extension

              (this overrides the dateext option).

              不使用dataext当作旧的日志文件名的扩展(覆盖dataext)



       nomail 

        Don’t mail old log files to any address.

        不邮寄日志文件给任何人



       nomissingok

              If  a  log  file  does  not  exist,  issue an error. This is the

              default.

              如果日志文件不存在, 打印一个错误.这是默认的选项



       noolddir

              Logs are rotated in the same directory the log normally  resides

              in (this overrides the olddir option).

              转储日志到跟日志文件所在的相同的目录下



       nosharedscripts

              Run prerotate and postrotate scripts for every log file which is

              rotated (this is the default, and  overrides  the  sharedscripts

              option).  The  absolute  path to the log file is passed as first

              argument to the script. If the  scripts  exit  with  error,  the

              remaining  actions  will  not  be  executed for the affected log

              only.

              在每一个日志转储后,运行preroteate和postrotate脚本.(这是默认的,会覆盖

              sharedscripts选项),把日志文件的绝对路径会当作第一参数传递给脚本, 如果

              脚本错误退出,对于受影响的日志,后续的动作不会再执行)



       noshred

              Do not use shred when deleting old log files. See also shred.

              在删除旧的文件是,不做粉碎处理.



       notifempty

              Do not rotate the log if it is empty (this overrides the ifempty

              option).

              当日志为空时,不作转储(覆盖ifempty)



       olddir directory

              Logs  are  moved into directory for rotation. The directory must

              be on the same physical device as the log  file  being  rotated,

              and  is  assumed to be relative to the directory holding the log

              file unless an absolute path name is specified. When this option

              is  used  all old versions of the log end up in directory.  This

              option may be overridden by the noolddir option.

              日志转储后将移动到的目录.目录必须跟要转储的日志在同一物理设备上, 并被

              假定为相对于日志文件所在的路径,除非指定了一个绝对路径.当使用了这个选项

              时,所有旧版本的日志会处在这个目录, 这个选项会被noolddir覆盖



       postrotate/endscript

              The lines between postrotate and endscript (both of  which  must

              appear  on  lines  by  themselves)  are executed (using /bin/sh)

              after the log file is rotated. These directives may only  appear

              inside a log file definition. Normally, the absolute path to the

              log file is passed as first argument to the script.  If  shared-

              scripts  is  specified,  whole  pattern is passed to the script.

              See also prerotate. See sharedscripts  and  nosharedscripts  for

              error handling.

              处在postrotate和endscript(这两个指令必须出现在单行中)之间的行将会被

              执行(使用/bin/sh),在日志切割完成后.这些指令只能出现在一个日志文件的

              定义中. 一般的, 日志文件的绝对路径将作为第一个参数传递给脚本. 如果

              指定了sharedscripts, 整个模式将被传递给脚本.又见prerotate. 见

              sharedscripts和nosharedscripts的错误处理.



       prerotate/endscript

              The  lines  between  prerotate and endscript (both of which must

              appear on lines by  themselves)  are  executed  (using  /bin/sh)

              before the log file is rotated and only if the log will actually

              be rotated. These directives may only appear inside a  log  file

              definition.  Normally,  the  absolute  path  to  the log file is

              passed as first argument to the script.   If   sharedscripts  is

              specified,  whole  pattern  is  passed  to the script.  See also

              postrotate.  See sharedscripts  and  nosharedscripts  for  error

              handling.

              处在postrotate和endscript(这两个指令必须出现在单行中)之间的行将会被

              执行(使用/bin/sh),在日志转储前且日志可以正常转储的情况下.这些指令只

              能出现在一个日志文件的定义中. 一般的, 日志文件的绝对路径将作为第一个

              参数传递给脚本. 如果指定了sharedscripts, 整个模式将被传递给脚本.又

              见postrotate. 见sharedscripts和nosharedscripts的错误处理.



       firstaction/endscript

              The  lines between firstaction and endscript (both of which must

              appear on lines by themselves) are executed (using /bin/sh) once

              before  all  log  files  that  match  the wildcarded pattern are

              rotated, before prerotate script is run and only if at least one

              log  will actually be rotated.  These directives may only appear

              inside a log file definition. Whole pattern  is  passed  to  the

              script  as  first  argument.  If the script exits with error, no

              further processing is done. See also lastaction.

              处在firstaction和endscript(这两个指定必须出现在单行中)之间的行将会被

              执行一次, 在所有通配符匹配到的日志文件转储前, 在prerotate脚本运行之前,

              并且至少有一个日志文件可以转储.这些指令只能出现在一个日志文件的定义中.

              整个模式将被当作第一参数传递给脚本.如果脚本错误退出,不会进一步进行处理.

              又见lastaction



       lastaction/endscript

              The lines between lastaction and endscript (both of  which  must

              appear on lines by themselves) are executed (using /bin/sh) once

              after all log  files  that  match  the  wildcarded  pattern  are

              rotated, after postrotate script is run and only if at least one

              log is rotated. These directives may only appear  inside  a  log

              file  definition. Whole pattern is passed to the script as first

              argument. If the script exits with error, just an error  message

              is shown (as this is the last action). See also firstaction.

              处在lastaction和endscript(这两个指定必须出现在单行中)之间的行将会被

              执行一次, 在所有通配符匹配到的日志文件转储后, 在postrotate脚本运行之后,

              并且至少有一个日志文件可以转储.这些指令只能出现在一个日志文件的定义中.

              整个模式将被当作第一参数传递给脚本.如果脚本错误退出,会打印错误日志(因为

              这个是最后一个动作).又见firstaction



       rotate count

              Log files are rotated count times before being removed or mailed

              to the address specified in a mail directive. If count is 0, old

              versions are removed rather than rotated.

              日志文件在删除或者邮寄之前可以转储的次数.如果次数为0, 旧日志文件将会被

              删除,而不是转储.



       size size

              Log  files are rotated only if they grow bigger then size bytes.

              If size is followed by k, the size is assumed  to  be  in  kilo-

              bytes.   If the M is used, the size is in megabytes, and if G is

              used, the size is in gigabytes. So size  100,  size  100k,  size

              100M and size 100Gare all valid.

              只有当日志文件大小超过size的时候会进行转储.如果size后面是k,则单位是

              千字节, M 兆字节, G 吉字节 所以size 100, size 100k, size 100M, size 100G

              都是可以的.



       sharedscripts

              Normally,  prerotate and postrotate scripts are run for each log

              which is rotated and the absolute path to the log file is passed

              as  first argument to the script. That means a single script may

              be run multiple times for log file entries which match  multiple

              files (such as the /var/log/news/* example). If sharedscripts is

              specified, the scripts are only run once,  no  matter  how  many

              logs  match  the wildcarded pattern, and whole pattern is passed

              to them.  However, if none of the logs in  the  pattern  require

              rotating,  the  scripts  will  not be run at all. If the scripts

              exit with error, the remaining actions will not be executed  for

              any  logs.  This option overrides the nosharedscripts option and

              implies create option.

              一般的prerotate 和 postrotate脚本运行于每个日志转储之后, 并且日志文件

              的绝对路径被当作第一参数传给脚本. 这意味着这个脚本当文件条目匹配多个

              文件(比如./var/log/news/*))时,也同样会执行多次. 如果指定了sharedscripts

              脚本只会执行一次,无论通配符匹配到多个文件,所有的模式都会传给脚本.

              然而,如果匹配的文件没有一个需要转储,脚本则不会运行,如果脚本错误退出,

              剩下的动作将不会执行.



       shred  Delete log files using  shred  -u  instead  of  unlink().   This

              should  ensure  that logs are not readable after their scheduled

              deletion; this is off by default.  See also noshred.

              对日志文件进行粉碎,而不是简单的删除.这样可以确保日志在删除后无法再读取

              默认关闭,又见noshred



       shredcycles count

              Asks GNU shred(1) to overwite log files count times before dele-

              tion.  Without this option, shred’s default will be used.

              在删除之前要执行的粉碎次数.如果不使用这个选项,shred会使用默认值.



       start count

              This is the number to use as the base for rotation. For example,

              if you specify 0, the logs will be created with a  .0  extension

              as they are rotated from the original log files.  If you specify

              9, log files will be created with a  .9,  skipping  0-8.   Files

              will  still  be  rotated  the number of times specified with the

              count directive.

              这个数值用来当作转储时的扩展名基数.比如,如果你指定了0, 当从原始日志

              文件进行转储时,会以.0作为扩展名.如果指定了9, 转储文件将会使用.9作为

              扩展名, 而跳过了0-8. 文件仍会进行由count指令指定次数的转储.



       tabooext [+] list

              The current taboo extension list is  changed  (see  the  include

              directive  for information on the taboo extensions). If a + pre-

              cedes the list of extensions, the current taboo  extension  list

              is  augmented,  otherwise  it is replaced. At startup, the taboo

              extension list contains .rpmorig, .rpmsave, ,v,  .swp,  .rpmnew,

              ~, .cfsaved and .rhn-cfg-tmp-*.

              修改当前禁止的扩展列表(查看包含关于禁止扩展信息的指令). 如果扩展名

之前存在+, 代表增强型的扩展列表,否则为替换???.新装时禁止的扩展列表

默认包含了.rpmorig, .rpmsave, ,v,  .swp,  .rpmnew,

              ~, .cfsaved and .rhn-cfg-tmp-*.等类型


       weekly Log  files  are  rotated if the current weekday is less than the

              weekday of the last rotation or if more than a week  has  passed

              since  the  last rotation. This is normally the same as rotating

              logs on the first day of the week, but it works better if logro-

              tate is not run every night.

              如果当前的工作日晚于上一次转储的工作日,或者自从上次转储后已经超过一个

              星期, 日志会进行转储. 和每周一进行转储状况相同???, 但如果任务不是每晚

              都运行的话, 这样会工作的更好.



       yearly Log files are rotated if the current year is not the same as the

              last rotation.

              当前年份如果不同于上一次转储时的年份,就会进行日志转储.



FILES

       /var/lib/logrotate.status  Default state file.

        默认状态文件.

       /etc/logrotate.conf        Configuration options.

        配置选项.


SEE ALSO

       gzip(1)


       <http://fedorahosted.org/logrotate/>


AUTHORS

       Erik Troan, Preston Brown, Jan Kaluza.


       <logrotate-owner@fedoraproject.org>





Linux                           Wed Nov 5 2002                    LOGROTATE(8)