This is an automated email from the ASF dual-hosted git repository.

monkeydluffy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 57a7dcdac feat: support configuring the buffer size of the access log 
(#10225)
57a7dcdac is described below

commit 57a7dcdac63a0bda55ddd41fc56a10c6144bfd51
Author: HaiYan <[email protected]>
AuthorDate: Wed Sep 20 00:42:18 2023 +0800

    feat: support configuring the buffer size of the access log (#10225)
---
 apisix/cli/ngx_tpl.lua   | 4 ++++
 conf/config-default.yaml | 1 +
 2 files changed, 5 insertions(+)

diff --git a/apisix/cli/ngx_tpl.lua b/apisix/cli/ngx_tpl.lua
index 4b4d94681..87ac17bec 100644
--- a/apisix/cli/ngx_tpl.lua
+++ b/apisix/cli/ngx_tpl.lua
@@ -365,8 +365,12 @@ http {
     log_format main escape={* http.access_log_format_escape *} '{* 
http.access_log_format *}';
     uninitialized_variable_warn off;
 
+    {% if http.access_log_buffer then %}
+    access_log {* http.access_log *} main buffer={* http.access_log_buffer *} 
flush=3;
+    {% else %}
     access_log {* http.access_log *} main buffer=16384 flush=3;
     {% end %}
+    {% end %}
     open_file_cache  max=1000 inactive=60;
     client_max_body_size {* http.client_max_body_size *};
     keepalive_timeout {* http.keepalive_timeout *};
diff --git a/conf/config-default.yaml b/conf/config-default.yaml
index d0b8c873d..05dc50ad7 100755
--- a/conf/config-default.yaml
+++ b/conf/config-default.yaml
@@ -213,6 +213,7 @@ nginx_config:                     # Config for render the 
template to generate n
   http:
     enable_access_log: true             # Enable HTTP proxy access logging.
     access_log: logs/access.log         # Location of the access log.
+    access_log_buffer: 16384            # buffer size of access log.
     access_log_format: "$remote_addr - $remote_user [$time_local] $http_host 
\"$request\" $status $body_bytes_sent $request_time \"$http_referer\" 
\"$http_user_agent\" $upstream_addr $upstream_status $upstream_response_time 
\"$upstream_scheme://$upstream_host$upstream_uri\""
     # Customize log format: http://nginx.org/en/docs/varindex.html
     access_log_format_escape: default   # Escape default or json characters in 
variables.

Reply via email to