zoukankan      html  css  js  c++  java
  • nginx日志格式

    nginx 日志格式

    log_format 有个默认的日志格式:

    log_format combined    '$remote_addr - $remote_user [$time_local]'
                 ' "$request" $status $body_bytes_sent '
                   ' "$http_referer" $http_user_agent"';
    iamhe

    ** nginx 默认调用 combined 格式来记录日志,即默认调用:(默认记录在access.log文件中)**

    access_log logs/access.log combined;

    nginx允许自定义日志格式,例如:

    log_format main    '$remote_addr - $remote_user [$time_local] "$http_host" "$request"'                     
               '$status $body_bytes_sent "$http_referer" '          '"$http_user_agent" $http_x_forwarded_for $request_time';

    以上是自定义了日志格式:main(main名称可以自定义)

    要想使其生效,就必须用access_log指定调用:

    access_log logs/xx.log main;

    iamge
    否则,nginx仍然会去调用combined格式来记录日志。

    更多日志的介绍

  • 相关阅读:
    Python2 cmp() 函数
    Python round() 函数
    Python floor() 函数
    Python ceil() 函数
    Python abs() 函数
    Python oct() 函数
    Python ord() 函数
    Python hex() 函数
    Python2 unichr() 函数
    Android--------工具类StatusBarUtil实现完美状态栏
  • 原文地址:https://www.cnblogs.com/ZFBG/p/11189598.html
Copyright © 2011-2022 走看看