log_zmq_server
Configures a ZeroMQ server endpoint for logging in NGINX.
Description
The log_zmq_server directive is used to configure a server endpoint that NGINX uses to log messages via ZeroMQ, which allows for efficient message-passing between NGINX and other subscribers or services. This directive specifies details such as the name of the logging server instance, the address of the ZeroMQ endpoint, the type of transport (IPC or TCP), the number of threads to be used for handling messages, and the size of the message queue.
Parameters for the log_zmq_server directive include:
1. **definition_name**: A unique name that identifies the ZeroMQ logger instance within the NGINX configuration.
2. **address**: The address of the ZeroMQ endpoint, which can be a TCP address (e.g., 127.0.0.1:5556) or an IPC path (e.g., /tmp/main.ipc).
3. **transport_type**: Specifies the transport layer protocol to use; either ipc or tcp.
4. **threads**: The number of threads to handle logging operations, improving throughput under load.
5. **queue_size**: The maximum number of queued messages that can be held when subscribers are slow to receive messages, which can help in managing backpressure on the logging system.
When properly configured, this directive provides a resilient logging mechanism that operates asynchronously, thereby not hindering the performance of the main NGINX processes.
Config Example
http {
log_zmq_server main "/tmp/main.ipc" ipc 4 1000;
log_zmq_format main '...';
}Ensure that the defined address is reachable and that any necessary permissions on IPC paths are available.
Using TCP may require firewall configuration to allow traffic on the specified port.
Ensure the ZeroMQ library is properly installed and configured in your environment.