Fix case where S6 timestamp is missing (#12040)

This commit is contained in:
Nicolas Mowen 2024-06-18 07:07:28 -06:00 committed by GitHub
parent 2cbc336bc0
commit bdda89b5e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -481,9 +481,13 @@ def logs(service: str):
for rawLine in contents.splitlines(): for rawLine in contents.splitlines():
cleanLine = rawLine.strip() cleanLine = rawLine.strip()
if len(cleanLine) < 10 or " " not in cleanLine: if len(cleanLine) < 10:
continue continue
# handle cases where S6 does not include date in log line
if " " not in cleanLine:
cleanLine = f"{datetime.now()} {cleanLine}"
if dateEnd == 0: if dateEnd == 0:
dateEnd = cleanLine.index(" ") dateEnd = cleanLine.index(" ")
keyLength = dateEnd - (6 if service_location == "frigate" else 0) keyLength = dateEnd - (6 if service_location == "frigate" else 0)