Skip to content

Instantly share code, notes, and snippets.

@haydenflinner
haydenflinner / drain.py
Created October 15, 2022 15:55
A cmd-line application that automatically translates text logs to parsed CSVs. Open your logs in visidata!
#!/usr/bin/env python
# Original source here, see that repo for other algos and links to papers.
# https://github.com/logpai/logparser
"""
Example usage of this cmdline program:
python drain.py mylogfile.log | vd -f csv
Hints:
Use , key (with cursor in template column) to select all rows like this one.
Then press " to open a new temporary page with only those rows,
@4n6ist
4n6ist / utmp.py
Created February 3, 2018 12:05
simple utmp parser
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# simple utmp parser
# Reference
# http://man7.org/linux/man-pages/man5/utmp.5.html
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at