2020
10-08
10-08
CentOS 7中Nginx日志定时拆分实现过程详解
一、编写拆分脚本(splitNginxLog.sh)*因为本例中设置每天0点进行日志的拆分,所以folder和rq均设置采用昨天的日期进行归档。#!/bin/bashfolder=`date-dyesterday+%Y%m`rq=`date-dyesterday+%Y%m%d`#原始日志路径logs_path="/var/log/nginx/sitename.com/"#日志备份路径logs_backup_path="/var/log/nginx/sitename.com/$folder"#要分割的日志logs_access="access"logs_error="error"#创建备份路径[-d$logs_backup_pa...
继续阅读 >