find_regex_custom function describes 'resp_length' could be integer or "-", but it wasn't the case. Made the change accordingly on the same base as 'bytes_sent'.
find_regex_custom function describes 'resp_length' could be integer or "-", but it wasn't the case. Made the change accordingly on the same base as 'bytes_sent'.
Romain Acciari committed
Oct 18, 2017 at 15:28 UTC
0591ceaafd536489cc61682369d4adb213faac47
1 file changed
+5
-4
python.d/web_log.chart.py
+5
-4
@@ -506,7 +506,8 @@ class Web(Mixin):
506
self.data['bytes_sent'] += int(bytes_sent)
507
# request processing time and bandwidth received
508
if 'resp_length' in match_dict:
509
- self.data['resp_length'] += int(match_dict['resp_length'])
509
+ resp_length = match_dict['resp_length'] if '-' not in match_dict['resp_length'] else 0
510
+ self.data['resp_length'] += int(resp_length)
511
if 'resp_time' in match_dict:
512
get_timings(timings=timings['resp_time'],
513
time=self.storage['func_resp_time'](float(match_dict['resp_time'])))
@@ -556,7 +557,7 @@ class Web(Mixin):
557
r' -.*?"(?P<request>[^"]*)"'
558
r' (?P<code>[1-9]\d{2})'
559
r' (?P<bytes_sent>\d+|-)'
559
- r' (?P<resp_length>\d+)'
560
+ r' (?P<resp_length>\d+|-)'
561
r' (?P<resp_time>\d+) ')
562
563
apache_ext_append = re.compile(r'(?P<address>[\da-f.:]+|localhost)'
@@ -564,7 +565,7 @@ class Web(Mixin):
565
r' (?P<code>[1-9]\d{2})'
566
r' (?P<bytes_sent>\d+|-)'
567
r' .*?'
567
- r' (?P<resp_length>\d+)'
568
+ r' (?P<resp_length>\d+|-)'
569
r' (?P<resp_time>\d+)'
570
r'(?: |$)')
571
@@ -670,7 +671,7 @@ class Web(Mixin):
671
mandatory_dict = {'address': r'[\w.:-]+',
672
'code': r'[1-9]\d{2}',
673
'bytes_sent': r'\d+|-'}
673
- optional_dict = {'resp_length': r'\d+',
674
+ optional_dict = {'resp_length': r'\d+|-',
675
'resp_time': r'[\d.]+',
676
'resp_time_upstream': r'[\d.-]+',
677
'method': r'[A-Z]+',