kerneltravel opened a new issue #6072: URL: https://github.com/apache/apisix/issues/6072
### Improved or typo fixed. accroding to doc https://github.com/apache/apisix/blob/master/docs/zh/latest/customize-nginx-configuration.md , I firstly put “nginx_config” inside scope “apisix” of file config/config.yaml ,which many people will do-also but found not work probably in resuting nginx.conf . the second (hard) work is the json format log as log-format “main” the third (hard) work is the incident requirement of the above doc, mean 4 space instead of 3space or 2space ,the later two-format space format will make apisix fail to restart. so here I'd share my fine-tuned demonstration of nginx_config. for somebody who need an example of this subject. nginx_config: http: error_log_level: "info" enable_access_log: true access_log: logs/access.log access_log_format: '{"@timestamp":"$time_iso8601","host":"$hostname","server_ip":"$server_addr","client_ip":"$remote_addr","xff":"$http_x_forwarded_for","domain":"$host","url":"$uri","referer":"$http_referer","args":"$args","upstreamtime":"$upstream_response_time","responsetime":"$request_time","request_method":"$request_method","status":"$status","size":"$body_bytes_sent","request_body":"$request_body","request_length":"$request_length","protocol":"$server_protocol","upstreamhost":"$upstream_addr","file_dir":"$uri","http_user_agent":"$http_user_agent"}' access_log_format_escape: json http_configuration_snippet: | log_format my-custom-logs-format '{"@timestamp":"$time_iso8601",' '"host":"$hostname",' '"server_ip":"$server_addr",' '"client_ip":"$remote_addr",' '"xff":"$http_x_forwarded_for",' '"domain":"$host",' '"url":"$uri",' '"referer":"$http_referer",' '"args":"$args",' '"upstreamtime":"$upstream_response_time",' '"responsetime":"$request_time",' '"request_method":"$request_method",' '"status":"$status",' '"size":"$body_bytes_sent",' '"request_body":"$request_body",' '"request_length":"$request_length",' '"protocol":"$server_protocol",' '"upstreamhost":"$upstream_addr",' '"file_dir":"$uri",' '"http_user_agent":"$http_user_agent"' '}'; ### Solution append this content in file config/config.yaml ``` nginx_config: http: error_log_level: "info" enable_access_log: true access_log: logs/access.log access_log_format: '{"@timestamp":"$time_iso8601","host":"$hostname","server_ip":"$server_addr","client_ip":"$remote_addr","xff":"$http_x_forwarded_for","domain":"$host","url":"$uri","referer":"$http_referer","args":"$args","upstreamtime":"$upstream_response_time","responsetime":"$request_time","request_method":"$request_method","status":"$status","size":"$body_bytes_sent","request_body":"$request_body","request_length":"$request_length","protocol":"$server_protocol","upstreamhost":"$upstream_addr","file_dir":"$uri","http_user_agent":"$http_user_agent"}' access_log_format_escape: json http_configuration_snippet: | log_format my-custom-logs-format '{"@timestamp":"$time_iso8601",' '"host":"$hostname",' '"server_ip":"$server_addr",' '"client_ip":"$remote_addr",' '"xff":"$http_x_forwarded_for",' '"domain":"$host",' '"url":"$uri",' '"referer":"$http_referer",' '"args":"$args",' '"upstreamtime":"$upstream_response_time",' '"responsetime":"$request_time",' '"request_method":"$request_method",' '"status":"$status",' '"size":"$body_bytes_sent",' '"request_body":"$request_body",' '"request_length":"$request_length",' '"protocol":"$server_protocol",' '"upstreamhost":"$upstream_addr",' '"file_dir":"$uri",' '"http_user_agent":"$http_user_agent"' '}'; ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
