access_log ngx_http_log_module
default: access_log logs/access.log combined;
Sets the path, format, and configuration for a buffered log write. Several logs can be specified on the same level. Logging to syslog can be configured by specifying the “syslog:” prefix in the first parameter. The special value off cancels all access_log directives on the current level. If the format is not specified then the predefined “combined” format is used.
The buffer size must not exceed the size of an atomic write to a disk file. For FreeBSD this size is unlimited.
access_log ngx_http_log_module
Link: https://nginx.org/en/docs/http/ngx_http_log_module.html#access_log
Syntax:
access_log path [format [buffer=size] [gzip[=level]] [flush=time] [if=condition]];
access_log off;`
default: access_log logs/access.log combined;
Sets the path, format, and configuration for a buffered log write. Several logs can be specified on the same configuration level. Logging to [syslog](https://nginx.org/en/docs/syslog.html) can be configured by specifying the “syslog:” prefix in the first parameter. The special value off cancels all access_log directives on the current level. If the format is not specified then the predefined “combined” format is used.
If either the buffer or gzip (1.3.10, 1.2.7) parameter is used, writes to log will be buffered.
The buffer size must not exceed the size of an atomic write to a disk file. For FreeBSD this size is unlimited.
Else
Maybe show full doc when hotkey triggered?
When buffering is enabled, the data will be written to the file:
if the next log line does not fit into the buffer;
if the buffered data is older than specified by the flush parameter (1.3.10, 1.2.7);
when a worker process is [re-opening](https://nginx.org/en/docs/control.html) log files or is shutting down.
If the gzip parameter is used, then the buffered data will be compressed before writing to the file. The compression level can be set between 1 (fastest, less compression) and 9 (slowest, best compression). By default, the buffer size is equal to 64K bytes, and the compression level is set to 1. Since the data is compressed in atomic blocks, the log file can be decompressed or read by “zcat” at any time.
Example:
access_log /path/to/log.gz combined gzip flush=5m;
For gzip compression to work, nginx must be built with the zlib library.
The file path can contain variables (0.7.6+), but such logs have some constraints:
the [user](https://nginx.org/en/docs/ngx_core_module.html#user) whose credentials are used by worker processes should have permissions to create files in a directory with such logs;
buffered writes do not work;
the file is opened and closed for each log write. However, since the descriptors of frequently used files can be stored in a [cache](https://nginx.org/en/docs/http/ngx_http_log_module.html#open_log_file_cache), writing to the old file can continue during the time specified by the [open_log_file_cache](https://nginx.org/en/docs/http/ngx_http_log_module.html#open_log_file_cache) directive’s valid parameter
during each log write the existence of the request’s [root directory](https://nginx.org/en/docs/http/ngx_http_core_module.html#root) is checked, and if it does not exist the log is not created. It is thus a good idea to specify both [root](https://nginx.org/en/docs/http/ngx_http_core_module.html#root) and access_log on the same configuration level:
server {
root /spool/vhost/data/$host;
access_log /spool/vhost/logs/$host;
...
The if parameter (1.7.0) enables conditional logging. A request will not be logged if the condition evaluates to “0” or an empty string. In the following example, the requests with response codes 2xx and 3xx will not be logged:
map $status $loggable {
~^[23] 0;
default 1;
}
access_log /path/to/access.log combined if=$loggable;
Actual
Expected
https://nginx.org/en/docs/http/ngx_http_log_module.html#access_log
Else
Maybe show full doc when hotkey triggered?