Often produce a variety of server log files, we need to be cleaned regularly
Classification log
System Log
Application Log
System Log
History information such as history crontab system running log General Log systems to help us better operation and maintenance, no additional configuration
Application Log
For example nginx running log of access and error logs, php frameworks, these logs are evidence of our troubleshooting
Tools logrotate
What is logrotate
logrotate most linux system comes with log cutting tool
logrotate applies scene
logrotate used to cut still being written by "dynamic" document that supports the file size or time intervals to trigger automatic segmentation file (automatic rotation)
Real
Nginx logs by day of the week to save compressed files, for 30 days, the configuration file is "/etc/logrotate.d/nginx"
The last code is as follows (I ubuntu system)
/data/logs/nginx/*.log {
daily
dateext
missingok
dateformat %Y%m%d
extension .log
rotate 30
compress
delaycompress
notifempty
create 640 nginx adm
sharedscripts
postrotate
[ -f /var/run/nginx.pid ] && kill -USR1 `cat /var/run/nginx.pid`
endscript
}
Performed manually (-d debug mode)
$ logrotate -d -f /etc/logrotate.d/nginx
Logrotate more specific usage of your own learning
Original Address: [operation and maintenance] logrotate log management tool artifact
label: logrotate nginx Access log
Intelligent Recommendation
- [Actual] Docker Getting real one: Install Dockeer
- Nginx disable IP IP segment
- [] No.4 Ionic modification cordova plug
- [Php] namespace and autoloaders relationship
- [Java] one server to configure multiple Tomcat
Reproduced in: https: //my.oschina.net/54php/blog/757183