Skip to content

Instantly share code, notes, and snippets.

@ninedraft
Created April 9, 2018 15:17
Show Gist options
  • Save ninedraft/128f590e0353c16189c55c9480fe17cb to your computer and use it in GitHub Desktop.
Save ninedraft/128f590e0353c16189c55c9480fe17cb to your computer and use it in GitHub Desktop.
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