Skip to content

Commit

Permalink
Merge pull request #13 from ml019/refactor-timezone-in-timestamp
Browse files Browse the repository at this point in the history
refactor: timezone in timestamp
  • Loading branch information
ml019 authored Nov 21, 2021
2 parents 20c0c1c + dea3d4a commit 20d990a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cloudwatch-firehose-es/src/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def transformLogEvent(log_event, cloudwatch_info):

json_event = {}

isotime = datetime.datetime.utcfromtimestamp( log_event['timestamp'] / 1000 ).isoformat()
isotime = datetime.datetime.fromtimestamp( log_event['timestamp'] / 1000, tz=datetime.timezone.utc ).isoformat()

try:
json_event = json.loads(log_event['message'])
Expand Down Expand Up @@ -216,6 +216,7 @@ def putRecordsToFirehoseStream(streamName, records, client, attemptsMade, maxAtt
for record in records:
with gzip.open(BytesIO(record['Data']), 'rb') as f:
print(json.loads(f.read()))
# Comment out the following line if testing locally
response = client.put_record_batch(DeliveryStreamName=streamName, Records=records)
except Exception as e:
failedRecords = records
Expand Down

0 comments on commit 20d990a

Please sign in to comment.