log_zmq_endpoint

The 'log_zmq_endpoint' directive configures the ZeroMQ endpoint for sending log messages in NGINX.

Syntaxlog_zmq_endpoint ;
Defaultnone
Contexthttp
Arguments2

Description

The 'log_zmq_endpoint' directive is part of the ZeroMQ logger module for NGINX, allowing users to specify an endpoint for logging messages to be sent through ZeroMQ. This directive takes two parameters: the name of the logger instance and the endpoint path. The endpoint is crucial because it indicates where the log messages should be published, enabling flexibility in how logs are processed and collected, whether through inter-process communication (IPC) or over a network using TCP or other protocols supported by ZeroMQ. By using this directive, system administrators can define multiple logging endpoints, each associated with different logging configurations, promoting better organization and data flow for log management.

The first argument, which corresponds to the logger instance, must match the name specified in the relevant 'log_zmq_server' directive. The second argument specifies the log endpoint, available in various communication methods, such as IPC or TCP. By using ZeroMQ, log messages can be sent asynchronously, allowing NGINX to maintain its performance by not blocking logging operations, even during high traffic peaks. This functionality is particularly beneficial in environments requiring stream processing or real-time analysis of log data, as the logs can be distributed efficiently without any loss.

Config Example

http {
    log_zmq_server main '/tmp/main.ipc' ipc 4 1000;
    log_zmq_endpoint main '/topic/';
    log_zmq_format main '{"remote_addr":"$remote_addr"}';
}

Ensure the defined <definition_name> matches one specified in a corresponding 'log_zmq_server' directive.

Verify that the endpoint path is correctly formatted for the desired communication method (IPC/TCP).

Remember that log messages are sent asynchronously; ensure proper handling on the subscriber side.

← Back to all directives