nginx--日志

/etc/nginx/nginx.conf中

http {
......

log_format main '$remote_addr - $remote_user [$time_iso8601] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

nginx -t

systemctl reload nginx

日志显示

2020/03/14 00:24:33 [error] 1261#1261: *199 limiting requests, excess: 6.000 by zone "req_test", client: 192.168.3.222, server: localhost, request: "GET /index.html HTTP/1.0", host: "192.168.3.222"

变成

192.168.3.222 - - [2020-03-14T01:19:16-04:00] "GET /index.html HTTP/1.0" 200 612 "-" "ApacheBench/2.3" "-"

原文地址:https://www.cnblogs.com/Leaders543/p/12491720.html