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     强制进行一次日志轮替,不论是否已经达到日志轮替的条件

  • 相关阅读:
    鸟哥的linux私房菜学习-(八)Linux 文件与目录管理
    我的作品
    聊聊软件测试面试的一些事
    如何做一名专业的软件测试工程师
    测试Leader应该做哪些事
    软件测试工程师的岗位职责
    一个完整的性能测试流程
    做接口测试需要哪些技能
    软件质量保障体系建设
    性能测试常见瓶颈分析及调优方法
  • 原文地址:https://www.cnblogs.com/413xiaol/p/7224078.html
Copyright © 2011-2022 走看看