`
hot88zh
  • 浏览: 178476 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Nginx日志清理

阅读更多

#!/bin/bash
log_dir="/Data/log"
time=`date +%Y%m%d`  
/bin/mv  ${log_dir}/nginx-access.log ${log_dir}/nginx-access.$time.log
kill -USR1 `cat  /var/run/nginx.pid`

 

Log Rotation

nginx will re-open it's logs in response to the USR1 signal.

$ mv access.log access.log.0
$ kill -USR1 <code>cat master.nginx.pid</code>
$ sleep 1
$ gzip access.log.0    # do something with access.log.0
可以按照日期来切割保存日志
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics