Ethan-Zhang-ZH opened a new pull request, #14031:
URL: https://github.com/apache/apisix/pull/14031
### Description
Please refer to #14022. This PR implements both enhancements proposed there.
**1. `backlog` for listen sockets**
```yaml
nginx_config:
http:
node_listen:
- ip: 0.0.0.0
port: 9080
backlog: 8192 # optional, absent -> rendered as today (nginx
default 511)
```
Renders the `backlog=N` parameter of the nginx `listen` directive, so
operators can
size the pending connections queue from config.yaml instead of relying on
the default
511 (which can overflow under connection spikes even when host-level
`net.core.somaxconn` is tuned).
**2. `if=` condition for access_log**
```yaml
nginx_config:
http:
access_log_if: $loggable # optional, absent -> rendered as today
http_configuration_snippet: |
map $status $loggable {
default 1;
}
```
Renders an `if=<condition>` parameter on the `access_log` directive. The
condition is
evaluated in the log phase and can reference variables declared via
`http_configuration_snippet` (`map` / `split_clients`), enabling log
sampling or
per-status / per-endpoint log exclusion with plain nginx config, without any
Lua plugin.
It is also the generic fix for #10407.
### Changes
- `apisix/cli/ops.lua`: pass an optional, validated `backlog` (positive
integer) through `listen_table_insert`
- `apisix/cli/ngx_tpl.lua`: render `backlog=N` and `if=<condition>` when
configured (output is byte-identical when absent)
- `conf/config.yaml.example`: document both fields
- `t/cli/test_main.sh`: backlog rendering + invalid-value test cases
- `t/cli/test_access_log.sh`: `if=` rendered / not-rendered test cases
Both fields are optional and fully backward compatible. All `t/cli` suites
touched by
these changes pass locally.
Fixes #14022
--
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]