[feat:1.18]更新日志为json格式;更新日志直接输出至/dev/stdout
This commit is contained in:
@@ -2,8 +2,8 @@ server {
|
||||
listen 8080;
|
||||
server_name localhost;
|
||||
|
||||
access_log /var/log/nginx/default.access.log main;
|
||||
error_log /var/log/nginx/default.access.log warn;
|
||||
#access_log /var/log/nginx/default.access.log main;
|
||||
#error_log /var/log/nginx/default.access.log warn;
|
||||
|
||||
location / {
|
||||
root /usr/local/nginx/html;
|
||||
|
||||
@@ -113,15 +113,28 @@ http {
|
||||
#gzip_static on;
|
||||
|
||||
# 定义日志格式
|
||||
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] "$request" '
|
||||
# '$status $body_bytes_sent "$http_referer" '
|
||||
# '"$http_user_agent" "$http_x_forwarded_for"';
|
||||
log_format main '{"time_local": "$time_local", '
|
||||
'"path": "$request_uri", '
|
||||
'"ip": "$remote_addr", '
|
||||
'"time": "$time_iso8601", '
|
||||
'"user_agent": "$http_user_agent", '
|
||||
'"user_id_got": "$uid_got", '
|
||||
'"user_id_set": "$uid_set", '
|
||||
'"remote_user": "$remote_user", '
|
||||
'"request": "$request", '
|
||||
'"status": "$status", '
|
||||
'"body_bytes_sent": "$body_bytes_sent", '
|
||||
'"request_time": "$request_time", '
|
||||
'"http_referrer": "$http_referer" }';
|
||||
|
||||
# 设置日志输出的路径、格式
|
||||
#access_log /var/log/nginx/access.log main;
|
||||
#error_log /var/log/nginx/error.log warn;
|
||||
access_log /dev/stdout main;
|
||||
error_log /dev/stdout warn;
|
||||
#error_log /dev/stdout warn;
|
||||
|
||||
# 关闭日志输出,提升性能
|
||||
#access_log /dev/null;
|
||||
|
||||
Reference in New Issue
Block a user