nginx自定义日志格式方法

nginx自定义日志格式方法

 

nginx.conf文件httpserver里面定义

 

    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   ldygo

        '$remote_addr|[$time_local]|$request_method|$content_length|$host|$request_uri|$status|'

        '$request_time|$body_bytes_sent|$upstream_addr|$upstream_status|$upstream_response_time|'

        '$http_referer|$http_x_forwarded_for|$http_user_agent';

 

    log_format   ldyfss

        '$remote_addr|[$time_local]|$server_protocol|$request_method|$content_length|$host|$request_uri|$status|'

        '$request_time|$body_bytes_sent|$upstream_addr|$upstream_status|$upstream_response_time|'

        '$http_referer|$http_x_forwarded_for|$http_user_agent';

 

 

    log_format logstash

 

'$remote_addr|$host|$request_uri|$status|$request_time|$body_bytes_sent|'

 

                '$upstream_addr|$upstream_status|$upstream_response_time|'

 

                '$http_referer|$http_x_forwarded_for|$http_user_agent';

 

posted @ 2022-05-24 23:37  谢端阳  阅读(467)  评论(0编辑  收藏  举报