mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-20 09:55:10 -04:00
improve version_str detection
This commit is contained in:
parent
1d31b88fa3
commit
80d7a30f13
2 changed files with 19 additions and 8 deletions
|
@ -380,21 +380,21 @@ IGNORABLE_404_URLS = [
|
|||
]
|
||||
|
||||
class NoisyRequestsFilter(logging.Filter):
|
||||
def filter(self, record):
|
||||
def filter(self, record) -> bool:
|
||||
logline = record.getMessage()
|
||||
|
||||
# ignore harmless 404s for the patterns in IGNORABLE_404_URLS
|
||||
for ignorable_url_pattern in IGNORABLE_404_URLS:
|
||||
ignorable_log_pattern = re.compile(f'^"GET /.*/?{ignorable_url_pattern.pattern[:-1]} HTTP/.*" (200|30.|404) .+$', re.I | re.M)
|
||||
if ignorable_log_pattern.match(logline):
|
||||
return 0
|
||||
return False
|
||||
|
||||
# ignore staticfile requests that 200 or 30*
|
||||
ignoreable_200_log_pattern = re.compile(r'"GET /static/.* HTTP/.*" (200|30.) .+', re.I | re.M)
|
||||
if ignoreable_200_log_pattern.match(logline):
|
||||
return 0
|
||||
return False
|
||||
|
||||
return 1
|
||||
return True
|
||||
|
||||
if CONFIG.LOGS_DIR.exists():
|
||||
ERROR_LOG = (CONFIG.LOGS_DIR / 'errors.log')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue