Skip to content

Commit

Permalink
Merge pull request #188 from shicholas/patch-2
Browse files Browse the repository at this point in the history
added another check for gzip files
  • Loading branch information
tianchu authored Jan 14, 2020
2 parents ff26d9c + f5f1250 commit aa6e24b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions aws/logs_monitoring/lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,8 +753,8 @@ def s3_handler(event, context, metadata):
body = response["Body"]
data = body.read()

# If the name has a .gz extension, then decompress the data
if key[-3:] == ".gz":
# Decompress data that has a .gz extension or magic header http://www.onicos.com/staff/iz/formats/gzip.html
if key[-3:] == ".gz" or data[:2] == b"\x1f\x8b":
with gzip.GzipFile(fileobj=BytesIO(data)) as decompress_stream:
# Reading line by line avoid a bug where gzip would take a very long time (>5min) for
# file around 60MB gzipped
Expand Down

0 comments on commit aa6e24b

Please sign in to comment.