Skip to content

Instantly share code, notes, and snippets.

@gullevek
Created November 29, 2019 07:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gullevek/df8fff72737136d31b4cb9a8f624ac54 to your computer and use it in GitHub Desktop.
Save gullevek/df8fff72737136d31b4cb9a8f624ac54 to your computer and use it in GitHub Desktop.
lnav log parser for web development customized
{
"web_dev": {
"title": "Web Development Log",
"description": "Development log from CoreLibs\\Basic Class",
"url": "http://www.egplusww.jp/",
"regex": {
"general": {
"pattern": "^\\[(?<date>\\d{4}-\\d{2}-\\d{2}) (?<timestamp>\\d{2}:\\d{2}:\\d{2}\\.\\d{8})\\] \\[(?<server>[\\w.]+)\\] \\[(?<sourcefile>\\/([A-Za-z0-9-_.]+\\/)+([A-Za-z0-9-_. ]+\\.(inc|php)))\\] \\[(?<puid>[\\w]+)\\] \\{(?<namespaceclass>[\\w]+(\\\\[\\w]+)*)\\} <(?<muid>[\\w ]+)> - (?<body>.*)"
}
},
"value": {
"date": { "kind": "string", "identifier": true },
"timestamp": { "kind": "string", "identifier": true },
"server": { "kind": "string", "identifier": true },
"sourcefile": { "kind": "string", "identifier": true },
"puid": { "kind": "string", "identifier": true },
"namespaceclass": {"kind": "string", "identifier": true},
"muid": { "kind": "string", "identifier": true }
},
"opid-field": "puid",
"level-field": "level",
"level": {
"fatal": "Fatal error",
"critical": "Notice",
"error": "Deprecated",
"warning": "Warning",
"debug": "Dump",
"tracae": "Trace"
},
"highlights": {
"db_general": {
"pattern": "\\[((?!(DB_WARNING|DB_ERROR))(\\w))+\\] \\{.+\\} -",
"color": "#ff8700"
},
"db_general_short": {
"pattern": "\\[((?!(DB_WARNING|DB_ERROR))(\\w))+\\] -",
"color": "#af5f00"
},
"db_error": {
"pattern": "\\[(DB_ERROR)\\] (\\{.+\\} )?-",
"color": "#c0c0c0",
"background-color": "#ff0000"
},
"db_warning": {
"pattern": "\\[(DB_WARNING)\\] (\\{.+\\} )?-",
"color": "#000000",
"background-color": "#808000"
},
"array": {
"pattern": "\\<pre\\>Array",
"color": "#af87af"
}
},
"sample": [
{ "line": "[2019-11-28 16:02:46.77559500] [host.domain.com] [/folder/other/www/admin/some_file.php] [a36446dc] {NameSpaceA\\ClassB} <GENERAL BACKEND DATA> - " },
{ "line": "[2019-11-15 17:00:30.56077600] [host.domain.com] [/folder/other/core_data/php_libraries/trunk/www/admin/namespace_test.php] [dfc2f09b] {CoreLibs\\Admin\\Backend} <db> - [__dbPrepareExec] {Q} - SET search_path TO 'public'" }
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment