nginx访问日志格式配置

    xiaoxiao2021-03-25  177

    在现网环境中nginx的访问日志对于故障定位(接口超时、网络异常)以及统计分析都十分有用,推荐使用以下log_format格式:

    log_format main '$remote_addr-$remote_user [$time_local][$status][$host] "$request" "$request_body"' '$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" ' '"$gzip_ratio" $request_time $bytes_sent $request_length';

    转载请注明原文地址: https://ju.6miu.com/read-3788.html

    最新回复(0)