zoukankan      html  css  js  c++  java
  • logrotate配置文件

    以nginx为例

    /var/log/nginx/*log {
        create 0644 nginx nginx
        daily
        rotate 10
        missingok
        notifempty
        compress
        sharedscripts
        postrotate
            /bin/kill -USR1 `cat /run/nginx.pid 2>/dev/null` 2>/dev/null || true
        endscript
    }

    配置参数

    说明

    monthly

    日志文件将按月轮循。其它可用值为'daily''weekly'或者'yearly'

    rotate 5

    一次将存储5个归档日志。对于第六个归档,时间最久的归档将被删除。

    compress

    在轮循任务完成后,已轮循的归档将使用gzip进行压缩。

    delaycompress

    总是与compress选项一起用,delaycompress选项指示logrotate不要将最近的归档压缩,压缩将在下一次轮循周期进行。这在你或任何软件仍然需要读取最新归档时很有用。

    missingok

    在日志轮循期间,任何错误将被忽略,例如“文件无法找到”之类的错误。

    notifempty

    如果日志文件为空,轮循不会进行。

    create 644 root root

    以指定的权限创建全新的日志文件,同时logrotate也会重命名原始日志文件。

    postrotate/endscript

    在所有其它指令完成后,postrotateendscript里面指定的命令将被执行。在这种情况下,rsyslogd 进程将立即再次读取其配置并继续运行。

     

     

     

  • 相关阅读:
    json字符串数组判断其中
    json字符串数组判断其中
    jquery select chosen禁用某一项option
    数据库培训知识
    人员管理模块代码总结2015/8/12整理
    正则表达式在STARLIMS中的应用总结
    控件属性表
    Form-公共代码
    Server-Script公共代码
    Celient-Script公共代码
  • 原文地址:https://www.cnblogs.com/drchen/p/11164292.html
Copyright © 2011-2022 走看看