Skip to content

Commit 0fa114b

Browse files
authored
Merge pull request #10 from padovan/logspec-process-gzip
logspec: process gzip files as well
2 parents 9af790a + 92b6351 commit 0fa114b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ docker logs postgres
163163
### Connecting to the Database
164164

165165
```bash
166-
docker exec -it postgres psql -U kcidb -d kcidb
166+
docker exec -it postgres psql -U kcidb_editor -d kcidb
167167
```
168168

169169
### Authentication

logspec-worker/logspec_api.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,13 @@ def process_log(log_file, parser, start_state):
187187
"""
188188
log = None
189189
with open(log_file, "rb") as f:
190-
log = f.read().decode("utf-8")
190+
magic = f.read(2)
191+
f.seek(0)
192+
if magic == b'\x1f\x8b':
193+
with gzip.open(f, "rt", encoding="utf-8") as gz:
194+
log = gz.read()
195+
else:
196+
log = f.read().decode("utf-8")
191197

192198
if not log:
193199
# If the log is empty, return an empty list

0 commit comments

Comments
 (0)