diff --git a/ecs_logging/_structlog.py b/ecs_logging/_structlog.py index 70a83ca..0465298 100644 --- a/ecs_logging/_structlog.py +++ b/ecs_logging/_structlog.py @@ -42,9 +42,9 @@ def format_to_ecs(self, event_dict): # type: (Dict[str, Any]) -> Dict[str, Any] if "@timestamp" not in event_dict: event_dict["@timestamp"] = ( - datetime.datetime.utcfromtimestamp(time.time()).strftime( - "%Y-%m-%dT%H:%M:%S.%f" - )[:-3] + datetime.datetime.fromtimestamp( + time.time(), tz=datetime.timezone.utc + ).strftime("%Y-%m-%dT%H:%M:%S.%f")[:-3] + "Z" )