zoukankan      html  css  js  c++  java
  • 日志分割

        1) /etc/logrotate.d
           实现nginx日志文件定时切割处理
           日志切割方法一: 利用脚本实现切割
           #!/bin/bash
           
           mv /var/log/nginx/access.log  /var/log/nginx/access_$(date +%F).log
           systemctl restart nginx
           日志切割方法二: 利用专用文件切割程序--logrotate
           vim /etc/logrotate.conf
           # 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   --- 加载包含/etc/logrotate.d/目录中文件配置
           
           # no packages own wtmp and btmp -- we'll rotate them here
           /var/log/wtmp {            --- 单独对某个文件进行切割配置
               monthly
               create 0664 root utmp
                  minsize 1M             --- 最小大小为1M,小于1M不进行切割              
               rotate 1
           }
           
           /var/log/btmp {
               missingok
               monthly
               create 0600 root utmp
               rotate 1
           }
  • 相关阅读:
    selenium的
    condition版生产者与消费者模式
    Xpath语法详解
    requests库的基本使用
    urlib库的使用
    MVC5+EF6 入门完整教程六
    MVC5+EF6 入门完整教程五
    MVC5+EF6 入门完整教程四
    MVC5 + EF6 完整入门教程三
    MVC5 + EF6 入门完整教程二
  • 原文地址:https://www.cnblogs.com/linux985/p/14091080.html
Copyright © 2011-2022 走看看