web_log bugfix: check if "all_time" is set to True before collect ips
Ilya committed
Jul 21, 2017 at 18:40 UTC
1ed76ec140fa6495b1a2b0530583f4ec26d8f6a5
1 file changed
+5
-5
python.d/web_log.chart.py
+5
-5
@@ -475,7 +475,6 @@ class Web(Mixin):
475
unique_current = set()
476
timings = defaultdict(lambda: dict(minimum=None, maximum=0, summary=0, count=0))
477
478
- ip_address_counter = {'unique_cur_ip': 0}
478
for line in filtered_data:
479
match = self.storage['regex'].search(line)
480
if match:
@@ -529,10 +528,11 @@ class Web(Mixin):
528
proto = 'ipv4' if '.' in match_dict['address'] else 'ipv6'
529
self.data['req_' + proto] += 1
530
# unique clients ips
532
- if address_not_in_pool(pool=self.storage['unique_all_time'],
533
- address=match_dict['address'],
534
- pool_size=self.data['unique_tot_ipv4'] + self.data['unique_tot_ipv6']):
535
- self.data['unique_tot_' + proto] += 1
531
+ if self.conf.get('all_time', True):
532
+ if address_not_in_pool(pool=self.storage['unique_all_time'],
533
+ address=match_dict['address'],
534
+ pool_size=self.data['unique_tot_ipv4'] + self.data['unique_tot_ipv6']):
535
+ self.data['unique_tot_' + proto] += 1
536
if match_dict['address'] not in unique_current:
537
self.data['unique_cur_' + proto] += 1
538
unique_current.add(match_dict['address'])