Today to learn nginx log management, log and cut through the log script and save it.
nginx log management
In the log format is provided nginx
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
}
Custom Service Logs
server {
listen 80;
server_name z.com;
access_log /var/log/nginx/z.com.access.log main;
}
nginx cutting timing of the task is completed log
The principle: by writing a script that will copy the current log file out of time and name, then use regular scheduled task execution timing can be.
# runlog.sh