nginx默认日志格式中,时间只有年月日时分秒,没有到毫秒级别
修改nginx配置文件日志格式,增加毫秒变量 $msec ngx_http_core_module.html#var_msec
# 修改前
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"';
查看访问日志,可以看到日志中请求中已有毫秒时间戳
本文最后更新时间 2023-02-13
文章链接地址:https://me.jinchuang.org/archives/896.html
本文内容未来会持续更新·本站文章除注明[转载|引用|原文]出处外,均为本站原生内容,转载前请注明出处