diff --git a/misc/log-analytics/import_logs.py b/misc/log-analytics/import_logs.py index 2aad9a4668aa591909c370b4ffec02fc7ba4db2f..0b1d66fc39f3ed3fac2e4ff4396c032c3bd87193 100755 --- a/misc/log-analytics/import_logs.py +++ b/misc/log-analytics/import_logs.py @@ -1414,8 +1414,7 @@ class Parser(object): return result def check_static(self, hit): - extension = hit.path.rsplit('.')[-1].lower() - if extension in STATIC_EXTENSIONS: + if hit.extension in STATIC_EXTENSIONS: if config.options.enable_static: hit.is_download = True return True @@ -1425,8 +1424,7 @@ class Parser(object): return True def check_download(self, hit): - extension = hit.path.rsplit('.')[-1].lower() - if extension in DOWNLOAD_EXTENSIONS: + if hit.extension in DOWNLOAD_EXTENSIONS: stats.count_lines_downloads.increment() hit.is_download = True return True @@ -1630,6 +1628,8 @@ class Parser(object): except BaseFormatException: hit.path, _, hit.query_string = hit.full_path.partition(config.options.query_string_delimiter) + hit.extension = hit.path.rsplit('.')[-1].lower() + try: hit.referrer = format.get('referrer') except BaseFormatException: