首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 操作系统 > Linux > logrotate
【标  题】:logrotate
【关键字】:logrotate
【来  源】:http://www.cublog.cn/u/22178/showart.php?id=154745

logrotate

logrotate

logrotate [options] config_files

System administration command. Manipulate logfiles according to commands given in config_files.

Options

-d, --debug

Debug mode. No changes will be made to logfiles.

-f, --force

Force rotation of logfiles.

-h, --help

Describe options.

-m command, --mail command

Use the specified command to mail logfiles. The default command is /bin/mail -s.

-s file, --state file

Save state information in file. The default is /var/lib/logrotate.status.

--usage

Show syntax and options.

-v, --verbose

Describe what is being done and what logfiles are affected.

Configuration Commands

Logrotate directives may appear on their own or as part of logfile definitions—instructions for specific logfiles. You may use wildcards to specify those files. Enclose directives for logfile definitions in a beginning and ending curly brace. For example:

compress /var/log/messages { rotate 5 weekly }

compress

Compress old versions of logfiles with gzip.

compresscmd command

Use command to compress logfiles. Default is gzip.

compressext extension

Append filename extension to compressed files instead of the compress command's default.

compressoptions options

Specify options to pass to the compress command. Default for gzip is -9 for maximum compression.

copy

Copy logfile, but do not change the original.

copytruncate

Copy logfile, then truncate it in place. For use with programs whose logging cannot be temporarily halted.

create [permissions] [owner] [group]

After rotation, re-create logfile with the specified permissions, owner, and group. permissions must be in octal. If any of these parameters is missing, the logfile's original attributes will be used.

daily

Rotate logfiles every day.

delaycompress

Don't compress logfile until the next rotation.

endscript

End a postrotate or prerotate script.

extension extension

Give rotated logfiles the specified extension. Any compression extension will be appended to this.

firstaction

May only be used as part of a logfile definition. Begin a shell script to execute once if any files match. The script ends when the endscript directive is read.

ifempty

Rotate logfile even if it is empty. Overrides the default notifempty option.

include file

Read the file into current file. If file is a directory, read all files in that directory into the current file.

lastaction

May only be used as part of a logfile definition. Begin a shell script to execute once after rotating all matching files and running any postrotate script. The script ends when the endscript directive is read.

mail address

Mail any deleted logs to address.

mailfirst

When using the mail command, mail the newly rotated log instead of the one being deleted.

maillast

When using the mail command, mail the log that is about to expire. This is the default behavior.

missingok

Skip missing logfiles. Do not generate an error.

monthly

Rotate logfiles only the first time logrotate is run in a month.

nocompress

Override compress.

nocopy

Override copy.

nocopytruncate

Override copytruncate.

nocreate

Override create.

nodelaycompress

Override delaycompress.

nomail

Override mail.

nomissingok

Override missingok.

noolddir

Override olddir.

nosharedscipts

Override sharedscripts. Run prerotate and postrotate scripts for each log rotated. This is the default.

notifempty

Override ifempty.

olddir directory

Move logs into directory for rotation. directory must be on the same physical device as the original logfiles.

postrotate

May only be used as part of a logfile definition. Begin a shell script to apply after the logfile is rotated. The script ends when the endscript directive is read.

prerotate

May only be used as part of a logfile definition. Begin a shell script to apply before a logfile is rotated. The script ends when the endscript directive is read.

rotate number

The number of times to rotate a logfile before removing it.

size n[k|M]

Rotate logfile when it is greater than n bytes. n can optionally be followed by k for kilobytes or M for megabytes.

sharedscripts

Run prescript and postscript only once for the session.

start n

Use n as the starting number for rotated logs. Default is 0.

tabooext [+] extlist

Replace taboo extension list with the given extlist. If + is specified, add to existing list. The default list is .rpmorig .rpmsave ,v .swp .rpmnew ~.

weekly

Rotate logfiles if more than a week has passed since their last rotation.

uncompresscmd command

Use command to uncompress logfiles. Default is gunzip.

look:【上一篇】
logname:【下一篇】
【相关文章】
  • linux下logrotate 配置和理解
  • 使用logrotate管理Linux日志
  • 【随机文章】
  • TP-Link智能企业网解决方案
  • format常用用法
  • [Symbian项目进展]防火墙日志模块的开发,附关键代码
  • Mozilla也有让人搞不明白的时候,Firefox不让你uncheck"清除缓存文件的提示对话框"。
  • C语言嵌入式系统编程修炼之一:背景篇
  • 查看apache,mysql进程
  • “超5类”与光纤该选择哪个?
  • google生日快乐
  • 如何看待中文编程 易语言 ?
  • 百兆以太网千兆升级方案(2)
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.