Skip to content

Instantly share code, notes, and snippets.

@Leovaldez42
Last active September 9, 2022 12:22
Show Gist options
  • Save Leovaldez42/50508a03597a08dfb53e3f925b781a0c to your computer and use it in GitHub Desktop.
Save Leovaldez42/50508a03597a08dfb53e3f925b781a0c to your computer and use it in GitHub Desktop.
import json
file_name = "a.json"
with open(file_name) as f1:
lines = f1.readlines()
# Removing Event, Event Number and the Number at the end, then parsing line as a json
lines = [json.loads(" ".join(line.split(" ")[2:-1])) for line in lines]
print ([line["log"] for line in lines])
@Leovaldez42
Copy link
Author

EVENTS 16623232889 {"log": "Hello I am someone", "stream": "a", "cluster-name": "432"} 3232
EVENTS 16623232890 {"log": "I am doing something.", "stream": "b", "cluster-name": "432"} 2321
EVENTS 16623232891 {"log": "bbye", "stream": "c", "cluster-name": "432"} 231231
EVENTS 16623232892 {"log": "bbyee", "stream": "d", "cluster-name": "432"} 23123212

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment