Created
April 9, 2018 15:17
-
-
Save ninedraft/128f590e0353c16189c55c9480fe17cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import shlex | |
import pandas as pd | |
import time | |
import random | |
import os, sys | |
random.seed(time.time()) | |
path = "/tmp/logeniue" | |
try: | |
os.mkfifo(path) | |
except OSError as e: | |
print("Failed to create FIFO: %s" % e) | |
else: | |
fifo = open(path, 'r') | |
def parse_kv_line(line): | |
return dict(token.split('=') for token in shlex.split(line)) | |
def parse_text_logs(log_stream): | |
return (parse_kv_line(log_line) | |
for log_line in log_stream | |
if log_line.strip()) | |
def read_pipe(): | |
for line in fifo: | |
yield parse_kv_line(line) | |
logs = pd.DataFrame(read_pipe()) | |
import qgrid | |
qgrid.show_grid(logs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment