/path_to_accesslog/access.log {
missingok
notifempty
size 100000k
daily
create 0644 www root
postrotate
[ ! -f /etc/nginx/logs/nginx.pid ] || kill -USR1 `cat /etc/nginx/logs/nginx.pid`
endscript
}
Explain:
missingok : do not output error if logfile is missing
notifempty : do not rotate if logfile is empty
size : Log file is rotated if it is bigger than 100000KB
daily : daily rotation
create 0644 www root : create new logfile with permission 644 where owner is www and group is root user.
postrotate
[ ! -f /etc/nginx/logs/nginx.pid ] || kill -USR1 `cat /etc/nginx/logs/nginx.pid`
endscript
=> tells nginx reload the log files .
Finish!!!
Nguyen Si Nhan
Bài đăng phổ biến
-
How to create a bot to automate daily tasks using Slack Nguyen Si Nhan 1. Setting Up Your Slack App Create a Slack App: Sign in to your Sla...
-
With this error: hudson.remoting.ProxyException: io.fabric8.kubernetes.client.KubernetesClientException: No httpclient implementations found...
Showing posts with label nginx with logrotate. Show all posts
Showing posts with label nginx with logrotate. Show all posts
Saturday, June 27, 2015
Subscribe to:
Posts (Atom)