Handle lowres timestamps
This commit is contained in:
parent
51880829f5
commit
391517658f
@ -33,9 +33,13 @@ class Server(object):
|
||||
|
||||
async def _handle_request(self, obj, writer: asyncio.StreamWriter) -> None:
|
||||
tag, time, record, options = obj
|
||||
seconds, nanoseconds = struct.unpack(">II", time.data)
|
||||
try:
|
||||
seconds, nanoseconds = struct.unpack(">II", time.data)
|
||||
record["time"] = datetime.fromtimestamp(seconds).replace(microsecond=int(nanoseconds/1000))
|
||||
except AttributeError:
|
||||
record["time"] = datetime.fromtimestamp(time)
|
||||
assert not options, "Can't handle options"
|
||||
record["time"] = datetime.fromtimestamp(seconds).replace(microsecond=int(nanoseconds/1000))
|
||||
|
||||
record.pop("container_id", None)
|
||||
record["host"] = FQDN
|
||||
result = await db.log.insert_one(record)
|
||||
|
Reference in New Issue
Block a user