Search code examples
nginxsyslog

nginx - syslog not logging with desired format


This is my nginx config, logging section:

  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;

But when I look at syslog files, I do not see '$request_time $upstream_response_time $pipe' part that I added. It only logs the default format.

Is there anything wrong? Somewhere I can check? Some issue with syslog itself maybe (length of log, etc)?

EDIT I tried increasing message size to 64k, issue is still there.


Solution

  • You should specify that you want to log using your custom format instead of the default one:

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