音乐分享(自动连播):
So cold
Not my baby
Wicked Game
What Is Love
Once Upon a Time
The Heart Of The Ocean
Sun Goes Down
Move That Body
Lose Control
云山
一趟
记录分享 记录是一种习惯 、分享是一种态度
Nginx日志时间添加毫秒显示
· 技术积累 · Nginx

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"';

查看访问日志,可以看到日志中请求中已有毫秒时间戳

nginxlogtime.png


本文最后更新时间 2023-02-13
文章链接地址:https://me.jinchuang.org/archives/896.html
本文内容未来会持续更新·本站文章除注明[转载|引用|原文]出处外,均为本站原生内容,转载前请注明出处


留言

顶部