Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Python logging format for Lnav - http://lnav.org/
{
"pythonlogger": {
"title": "Python logger format",
"description": "Log format used by python logger class",
"url": "",
"regex": {
"main" : {
"pattern": "^\\[(?<timestamp>\\d{2}\\\/\\d{2}\\\/\\d{4} \\d{2}:\\d{2}:\\d{2})\\] (?<level>\\w+) (?<module>\\w+) (?<body>.*)$"
}
},
"timestamp-format": ["%d/%m/%Y %H:%M:%S"],
"level-field": "level",
"level": {
"critical": "CRITICAL",
"error": "ERROR",
"warning": "WARNING",
"info": "INFO",
"debug": "DEBUG"
},
"value": {
"level": { "kind" : "string", "identifier" : true },
"module": { "kind" : "string", "identifier" : true },
"body": { "kind" : "string" }
},
"sample": [
{
"line": "[12/01/2017 17:32:02] INFO views Error creating file"
}
]
}
}
@benje
Copy link
Author

benje commented Oct 23, 2017

To install:

Download this file and copy it to ~/.lnav/formats/lnav_format_python.json.

Run the following lnav command to install the format permanently:
lnav -i ~/.lnav/formats/lnav_format_python.json

http://lnav.readthedocs.io/en/latest/formats.html#installing-formats

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