server_traffic_status_filter_check_duplicate
The `server_traffic_status_filter_check_duplicate` directive enables or disables the checking for duplicate filter keys in NGINX stream server traffic status.
Description
The server_traffic_status_filter_check_duplicate directive allows for the configuration of duplicate filter key checking within the NGINX stream server traffic status module. When set to 'on', this directive ensures that the keys used for bandwidth and connection statistics are unique; otherwise, the presence of duplicate keys can result in incorrect metrics being reported. The underlying logic implements a comparison mechanism where each filter key is evaluated, and any duplicates are filtered out, preserving only unique keys for accurate traffic monitoring.
This mechanism is particularly important when multiple server instances may apply the same filter configuration, potentially leading to misreporting the statistics if duplicate keys exist. By enforcing uniqueness, the directive plays a critical role in maintaining the integrity of the statistical data generated by the traffic status module. Users can define 'off' (the default value) or 'on' to toggle this behavior based on their application's needs, ensuring either a relaxed or strict approach to filter key management.
Config Example
stream {
server {
server_traffic_status;
server_traffic_status_zone;
server_traffic_status_filter_check_duplicate on;
...
}
}Setting this directive to 'on' may require careful planning of filter keys to avoid unintentional omissions in reported metrics.
Remember that if multiple configurations are used that share filter keys, they should be synchronized to prevent duplicate key issues.