Skip to content

Commit

Permalink
Fix timezone in log arrival and delta time
Browse files Browse the repository at this point in the history
  • Loading branch information
ppcad committed Nov 29, 2024
1 parent 4747129 commit 698a7ba
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions logprep/abc/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
import zlib
from abc import abstractmethod
from copy import deepcopy
from functools import partial
from functools import partial, cached_property
from hmac import HMAC
from typing import Optional, Tuple
from zoneinfo import ZoneInfo

from attrs import define, field, validators

Expand Down Expand Up @@ -198,6 +199,11 @@ def _add_version_info(self):
"""Check and return if the version info should be added to the event."""
return bool(self._config.preprocessing.get("version_info_target_field"))

@cached_property
def _log_arrival_timestamp_timezone(self):
"""Returns the timezone for log arrival timestamps"""
return ZoneInfo("UTC")

@property
def _add_log_arrival_time_information(self):
"""Check and return if the log arrival time info should be added to the event."""
Expand Down Expand Up @@ -314,7 +320,7 @@ def _add_arrival_time_information_to_event(self, event: dict):
new_field = {
self._config.preprocessing.get(
"log_arrival_time_target_field"
): TimeParser.now().isoformat()
): TimeParser.now(self._log_arrival_timestamp_timezone).isoformat()
}
add_fields_to(event, new_field)

Expand Down

0 comments on commit 698a7ba

Please sign in to comment.