Commit 6b00badf authored by Vincent Pelletier's avatar Vincent Pelletier

Match skipped user agents as regexes instead of verbatim.

This change introduces a (minor) parameter value backward-incompatibility.
parent b42f842a
...@@ -1421,7 +1421,8 @@ def main(): ...@@ -1421,7 +1421,8 @@ def main():
per_site[site] = site_stats per_site[site] = site_stats
print('done (%s)' % timedelta(seconds=time.time() - load_start), print('done (%s)' % timedelta(seconds=time.time() - load_start),
file=sys.stderr) file=sys.stderr)
skip_user_agent = list(itertools.chain(*args.skip_user_agent)) skip_user_agent = [re.compile(x).match
for x in itertools.chain(*args.skip_user_agent)]
malformed_lines = 0 malformed_lines = 0
skipped_lines = 0 skipped_lines = 0
no_url_lines = 0 no_url_lines = 0
...@@ -1460,7 +1461,8 @@ def main(): ...@@ -1460,7 +1461,8 @@ def main():
file=sys.stderr) file=sys.stderr)
malformed_lines += 1 malformed_lines += 1
continue continue
if match.group('agent') in skip_user_agent: agent = match.group('agent')
if any(x(agent) for x in skip_user_agent):
skipped_user_agent += 1 skipped_user_agent += 1
continue continue
url_match = matchrequest(match.group('request')) url_match = matchrequest(match.group('request'))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment