代码之家  ›  专栏  ›  技术社区  ›  vfsoraki

nginx-syslog没有以所需格式记录

  •  0
  • vfsoraki  · 技术社区  · 8 年前

      log_format timed_combined '$remote_addr - $remote_user [$time_local] '
                    '"$request" $status $body_bytes_sent '
                    '"$http_referer" "$http_user_agent" '
                    '$request_time $upstream_response_time $pipe';
    
      access_log syslog:server=127.0.0.1:514,facility=local0,tag=nginx;
      error_log syslog:server=127.0.0.1:514,facility=local1,tag=nginx;
    

    但是当我查看syslog文件时,我没有看到 '$request_time $upstream_response_time $pipe' 我添加的部分。它只记录默认格式。

    编辑

    1 回复  |  直到 8 年前
        1
  •  0
  •   IVO GELOV    8 年前

    您应该指定要使用自定义格式而不是默认格式进行日志记录:

    access_log syslog:server=127.0.0.1:514,facility=local0,tag=nginx timed_combined buffer=8k;