Home > Database > Mysql Tutorial > Nginx日志分割

Nginx日志分割

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 15:06:35
Original
1406 people have browsed it

创建 日志 分割 脚本 vi /root/cut_logs.sh #!/bin/bash #This script run at 00:00 # The Nginx logs path logs_path=/data/logs/ mkdir -p ${logs_path}$(date -d yesterday +%Y)/$(date -d yesterday +%m)/ mv ${logs_path}access.log ${logs_path}$(date

创建日志分割脚本

vi /root/cut_logs.sh

 

#!/bin/bash

#This script run at 00:00

# The Nginx logs path

logs_path="/data/logs/"

mkdir -p ${logs_path}$(date -d "yesterday" +"%Y")/$(date -d "yesterday" +"%m")/

mv ${logs_path}access.log ${logs_path}$(date -d "yesterday" +"%Y")/$(date -d "yesterday" +"%m")/access_$(date -d "yesterday" +"%Y%m%d").log

/usr/local/nginx/sbin/nginx  -s reload

设置cut_logs.sh执行权限

chmod +x /root/cut_logs.sh

cut_logs.sh自动执行时间

00 00 * * * /root/cut_logs.sh

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Error restarting nginx
From 1970-01-01 08:00:00
0
0
0
server - Nginx configuration webapp problem
From 1970-01-01 08:00:00
0
0
0
Nginx default.conf problem
From 1970-01-01 08:00:00
0
0
0
centos7 - NGINX exception occurs
From 1970-01-01 08:00:00
0
0
0
nginx load balancing
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template