zoukankan      html  css  js  c++  java
  • Linux中的日志功能

    配置文件 /etc/logrotate.conf 
    daily
      日志的轮替周期是每天
    weekly
      日志的轮替周期是每周
    monthly
      日志的轮替周期是每月
    rotate 数字
      保留的日志文件的个数
    compress
      日志轮替时旧的日志进行压缩
    create mode owner group
      建立新日志,同时指定新日志的权限与所有者和所属组
    mail address
      当日志轮替时,输出内容通过邮件发送到指定邮件地址
    missingok
      如果日志不存在,则忽略该日志的警告信息
    notifempty
      如果日志为空,则不进行日志轮替
    minsize 数字
      日志一定要达到这个最小值才会轮替,否则就算时间到了也不轮替
    size 数字
      日志只有大于指定大小才进行轮替,而不是按照时间轮替
    dateext
      使用日期作为日志轮替文件的后缀


    [root@localhost ~]# cat /etc/logrotate.conf
    # see "man logrotate" for details
    # rotate log files weekly
    weekly

    # keep 4 weeks worth of backlogs
    rotate 4

    # create new (empty) log files after rotating old ones
    create

    # use date as a suffix of the rotated file
    dateext

    # uncomment this if you want your log files compressed
    #compress

    # RPM packages drop log rotation information into this directory
    include /etc/logrotate.d

    # no packages own wtmp and btmp -- we'll rotate them here
    /var/log/wtmp {
    monthly
    create 0664 root utmp
    minsize 1M
    rotate 1
    }

    /var/log/btmp {
    missingok
    monthly
    create 0600 root utmp
    rotate 1
    }

    # system-specific logs may be also be configured here.
    [root@localhost ~]#

    logrotate [选项] /etc/logrotate.cong
      -v    显示日志轮替的过程
      -f     强制进行一次日志轮替,不论是否已经达到日志轮替的条件

  • 相关阅读:
    (转)Xargs用法详解
    (转)运维老鸟教你安装centos6.5如何选择安装包
    (转)正则表达式与三剑客的使用技巧
    php OAuth服务端编写
    前端工程精粹(一):静态资源版本更新与缓存
    静态资源打包:一个javescript 的src引用多个文件,一个link引用多个CSS文件
    ie,cookie,域名与下划线
    HTML中css和js链接中的版本号
    PHP 优化详解
    jqury插件编写
  • 原文地址:https://www.cnblogs.com/413xiaol/p/7224078.html
Copyright © 2011-2022 走看看