nginx配置文件 怎么表示10位时间戳
在nginx配置文件中,可以使用变量 $msec 来表示当前的时间戳,它是一个十位数的时间戳(单位为秒)。你可以在需要的地方使用该变量来表示时间戳。
以下是一个示例:
location / {
log_format mylog '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $msec';
access_log /var/log/nginx/access.log mylog;
}
在上述示例中,$msec 变量被用于自定义日志格式 mylog 中的 $msec 字段。日志文件 /var/log/nginx/access.log 将记录每个请求的时间戳。
原文地址: https://www.cveoy.top/t/topic/ixZc 著作权归作者所有。请勿转载和采集!