zoukankan      html  css  js  c++  java
  • nginx转换json格式

    一、在nginx  http模块下加入下面

       log_format json '{"@timestamp":"$time_iso8601",'
                      '"host":"$server_addr",'
                      '"service":"nginxTest",'
                      '"trace":"$upstream_http_ctx_transaction_id",'
                      '"log":"log",'
                      '"clientip":"$remote_addr",'
                      '"remote_user":"$remote_user",'
                      '"request":"$request",'
                      '"http_user_agent":"$http_user_agent",'
                      '"size":$body_bytes_sent,'
                      '"responsetime":$request_time,'
                      '"upstreamtime":"$upstream_response_time",'
                      '"upstreamhost":"$upstream_addr",'
                      '"http_host":"$host",'
                      '"url":"$uri",'
                      '"domain":"$host",'
                      '"xff":"$http_x_forwarded_for",'
                      '"referer":"$http_referer",'
                      '"status":"$status"}';
        access_log /var/log/nginx/access.log json ;

    二、重启nginx后查看日志

    cat  /var/log/nginx/access.log

  • 相关阅读:
    稠密光流
    分水岭分割
    Haar小波分析
    内积空间
    矩阵LU分解
    opencv笔记---contours
    Deformable Templates For Eye Detection
    最小二乘法
    字符集及编码
    层次聚类
  • 原文地址:https://www.cnblogs.com/wangyong-blog/p/13679300.html
Copyright © 2011-2022 走看看