diff options
author | Ilya <ilyamaschenko@gmail.com> | 2017-08-07 10:30:29 +0900 |
---|---|---|
committer | Ilya <ilyamaschenko@gmail.com> | 2017-08-07 10:30:29 +0900 |
commit | 609ebf67567fad3380e9fc7b9d91d4d0778621d3 (patch) | |
tree | a644cef7f85c04137f393d7363a0ef75ff5558eb /python.d | |
parent | df957395370e656a9961a5b3cfa8d4db80801282 (diff) |
web_log bugfix: properly parse squid response codes
Diffstat (limited to 'python.d')
-rw-r--r-- | python.d/web_log.chart.py | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/python.d/web_log.chart.py b/python.d/web_log.chart.py index 1f47eb3bd4..70c3528e43 100644 --- a/python.d/web_log.chart.py +++ b/python.d/web_log.chart.py @@ -1,17 +1,20 @@ # -*- coding: utf-8 -*- # Description: web log netdata python.d module # Author: l2isbad -import re + import bisect -from os import access, R_OK -from os.path import getsize +import re + from collections import namedtuple, defaultdict from copy import deepcopy +from os import access, R_OK +from os.path import getsize try: from itertools import filterfalse except ImportError: from itertools import ifilterfalse as filterfalse + from base import LogService import msg @@ -937,18 +940,21 @@ class Squid(Mixin): :return: """ if code not in self.data: - self.add_new_dimension(dimension_id=code, chart_key='squid_code') + self.add_new_dimension(dimension_id=code, + chart_key='squid_code') self.data[code] += 1 - if '_' not in code: - return + for tag in code.split('_'): try: chart_key = SQUID_CODES[tag] except KeyError: continue - if tag not in self.data: - self.add_new_dimension(dimension_id=tag, chart_key=chart_key) - self.data[tag] += 1 + dimension_id = '_'.join(['code_detailed', tag]) + if dimension_id not in self.data: + self.add_new_dimension(dimension_id=dimension_id, + dimension=tag, + chart_key=chart_key) + self.data[dimension_id] += 1 def get_timings(timings, time): |