没有直接的方法。但可以自定义日志格式并更改变量。所以我们可以用它来锻炼
events {
worker_connections 1024;
}
http {
map $time_iso8601 $time_aws {
~(.*):(00) "$1$2";
}
log_format new_format '$remote_addr - $remote_user [$time_aws] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
access_log /dev/stdout new_format;
server {
listen 80;
location / {
return 200 "test";
}
}
}
这给我下面的访问日志
172.19.0.1 - - [2017-09-29T16:43:55+0000] "GET /tarun HTTP/1.1" 200 51 "-" "curl/7.47.0"