nginx默认日志格式中,时间只有年月日时分秒,没有到毫秒级别
# 修改前
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
# 修改后 (连接符号自定义我这里用的是 . )
log_format main '$remote_addr - $remote_user [$time_local.$msec] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
查看访问日志,可以看到日志中请求中已有毫秒时间戳
商业转载请联系作者获得授权,非商业转载请注明出处 本文地址:https://me.jinchuang.org/archives/896.html