Skip to content

Instantly share code, notes, and snippets.

View matt-sm's full-sized avatar

Matt Smith matt-sm

View GitHub Profile
# Parse syslog file for logs (per hour) that match message
# Prior art: https://github.com/dabeaz/generators
from dateutil import parser
from collections import Counter
import re
logpats = r"(\S+ \d+ \d+:\d+:\d+) (\S+) (.*]:|.*]\):|.*\):) (.*)"
colnames = ("datetime", "host", "process", "message")
message = "Killed"