Skip to content

Instantly share code, notes, and snippets.

@jonathandey
Last active October 3, 2023 08:40
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonathandey/d81c939b3a05bd60b13356c1c0601d68 to your computer and use it in GitHub Desktop.
Save jonathandey/d81c939b3a05bd60b13356c1c0601d68 to your computer and use it in GitHub Desktop.
lnav formatter for Laravel logs
Regex from: https://github.com/haruncpi/laravel-log-reader
JSON based on: https://gist.github.com/fquinto/e137ce236297804a55a1e4d783373316
lnav: https://github.com/tstack/lnav
Installing a new lnav format: https://docs.lnav.org/en/latest/formats.html#installing-formats
{
"laravellogger": {
"title": "Laravel logger format",
"description": "Log format used by Laravel logger class",
"url": "",
"regex": {
"main" : {
"pattern": "\\[(?<timestamp>.*)\\]\\s(?<env>\\w+)\\.(?<level>\\w+):(?<body>.*)"
}
},
"timestamp-format": ["%Y-%m-%d %H:%M:%S"],
"level-field": "level",
"level": {
"critical": "CRITICAL",
"error": "ERROR",
"warning": "WARNING",
"info": "INFO",
"debug": "DEBUG"
},
"value": {
"level": { "kind" : "string", "identifier" : true },
"env": { "kind" : "string", "identifier" : true },
"body": { "kind" : "string" }
},
"sample": [
{
"line": "[2021-11-04 21:25:12] test.DEBUG: A problem occurred"
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment