server_traffic_status_limit_traffic_by_set_key

Limits traffic statistics collection based on specified keys.

Syntaxserver_traffic_status_limit_traffic_by_set_key key1 [key2 [key3]];
Defaultnone
Contextstream, stream server
Arguments2-3

Description

The server_traffic_status_limit_traffic_by_set_key directive is part of the NGINX Stream Server Traffic Status module and is used to configure traffic limits for the NGINX stream servers based on a specified set of keys. This directive enhances monitoring by allowing administrators to define how traffic statistics are aggregated and reported. By using this directive, you can specify a unique identifier that indicates how metrics should be grouped, making it easier to analyze traffic patterns and performance of different servers or services running within the NGINX framework.

This directive takes two to three arguments, which include the specific keys to use for traffic tracking. Administrators can define these keys based on their traffic analysis needs—common examples might include service name or client IP. The behavior of the directive is dependent on these parameters, as specifying an incorrect or overly generic key can lead to misleading traffic statistics. This makes careful planning and key management crucial when deploying this directive.

When applied in the context of the stream or stream server block, this directive facilitates detailed traffic analysis efforts, helping to prevent potential overload conditions by allowing easier monitoring of traffic quotas for specific segments of the workload.

Config Example

stream {
    server {
        listen 12345;
        server_traffic_status_limit_traffic_by_set_key client_ip;
        ...
    }
}

Ensure that the keys specified do not overlap unless intended, as this can lead to inaccurate statistics.

Be cautious about the number of unique keys tracked; excessive unique entries may increase memory usage and processing time.

Consider the performance impact of logging traffic for too many keys in high-traffic situations. Ignoring performance optimization strategies can lead to unexpected server slowdowns.

← Back to all directives