From 73fe3dea9778b444e53c6a3fe78c22dff3e51c59 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 14 May 2024 07:36:02 +0200 Subject: [PATCH] feat: hide localhost traffic --- pollect/sources/K8sNamespaceTrafficSource.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pollect/sources/K8sNamespaceTrafficSource.py b/pollect/sources/K8sNamespaceTrafficSource.py index 99e6128..be87916 100644 --- a/pollect/sources/K8sNamespaceTrafficSource.py +++ b/pollect/sources/K8sNamespaceTrafficSource.py @@ -22,6 +22,7 @@ def __init__(self, config): super().__init__(config) self._namespace_label = config.get('namespaceLabel', 'namespace') self._traffic_log_mode = config.get('trafficLog') + hide_localhost_traffic = config.get('hideLocalhostTraffic', True) self.known_networks: List[NamedNetworks] = [] for network in config.get('networks', []): @@ -29,7 +30,7 @@ def __init__(self, config): self.known_networks.append(NamedNetworks(name, network['cidrs'])) # Add catch-any as last item - self.known_networks.append(NamedNetworks('localhost', ['127.0.0.1'], hide=True)) + self.known_networks.append(NamedNetworks('localhost', ['127.0.0.0/8'], hide=hide_localhost_traffic)) self.known_networks.append(NamedNetworks('other', ['0.0.0.0/0'], catch_all=True)) self._metrics = NamespacesMetrics(self.known_networks)