Last active
December 2, 2019 01:21
-
-
Save gullevek/0cc26fe7da27908ec9b5c7bf23bab720 to your computer and use it in GitHub Desktop.
lnav php error log parser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"php_log": { | |
"title": "PHP error log format", | |
"description": "Error Log format used by PHP (and PHP-FPM)", | |
"url": "http://www.php.net/", | |
"regex": { | |
"general": { | |
"pattern": "^\\[(?<date>\\d{2}-\\w{3}-\\d{4}) (?<timestamp>\\d{2}:\\d{2}:\\d{2}) (?<timezone>\\w+(\\/\\w+)?)\\] (?<level>PHP [\\w ]+): (?<body>.*)" | |
}, | |
"dump": { | |
"pattern": "^\\[(?<date>\\d{2}-\\w{3}-\\d{4}) (?<timestamp>\\d{2}:\\d{2}:\\d{2}) (?<timezone>\\w+(\\/\\w+)?)\\] PHP (?<level>Dump) (?<body>.*)" | |
}, | |
"trace": { | |
"pattern": "^\\[(?<date>\\d{2}-\\w{3}-\\d{4}) (?<timestamp>\\d{2}:\\d{2}:\\d{2}) (?<timezone>\\w+(\\/\\w+)?)\\] PHP (?<body>Stack trace):" | |
}, | |
"other": { | |
"pattern": "^\\[(?<date>\\d{2}-\\w{3}-\\d{4}) (?<timestamp>\\d{2}:\\d{2}:\\d{2}) (?<timezone>\\w+(\\/\\w+)?)\\] PHP (?<body>.*)" | |
}, | |
"empty": { | |
"pattern": "^\\[(?<date>\\d{2}-\\w{3}-\\d{4}) (?<timestamp>\\d{2}:\\d{2}:\\d{2}) (?<timezone>\\w+(\\/\\w+)?)\\] PHP $" | |
} | |
}, | |
"value": { | |
"date": { "kind": "string", "identifier": true }, | |
"timestamp": { "kind": "integer", "identifier": true }, | |
"timezone": { "kind": "string", "identifier": true }, | |
"level": { "kind": "string", "identifier": true } | |
}, | |
"level-field": "level", | |
"level": { | |
"fatal": "Fatal error", | |
"critical": "Parse error", | |
"error": "Notice", | |
"warning": "Warning", | |
"info": "Deprecated", | |
"debug": "Dump" | |
}, | |
"highlights": { | |
"fatal_error": { | |
"pattern": "PHP Fatal error:", | |
"color": "#c0c0c0", | |
"background-color": "#ff0000" | |
}, | |
"parse_error": { | |
"pattern": "PHP Parse error:", | |
"color": "#c0c0c0", | |
"background-color": "#d70000" | |
}, | |
"warning": { | |
"pattern": "PHP Warning:", | |
"color": "#000000", | |
"background-color": "#808000" | |
}, | |
"notice": { | |
"pattern": "PHP Notice:", | |
"color": "#000000", | |
"background-color": "#008080" | |
}, | |
"deprecated": { | |
"pattern": "PHP Deprecated:", | |
"color": "#000000", | |
"background-color": "#800080" | |
}, | |
"stack": { | |
"pattern": "Stack trace:", | |
"color": "#ffaf00" | |
}, | |
"stack-line": { | |
"pattern": "\\/([A-Za-z0-9-_.]+\\/)+([A-Za-z0-9-_. ]+\\.(inc|php))?\\(\\d+\\)\\s?:", | |
"color": "#ff00ff" | |
}, | |
"stack-line-message": { | |
"pattern": "\\(\\d+\\): (.*)", | |
"color": "#c0c0c0" | |
}, | |
"stack-line-last": { | |
"pattern": "#\\d+ (\\{.*\\})", | |
"color": "#c0c0c0" | |
}, | |
"file": { | |
"pattern": "\\/([A-Za-z0-9-_.]+\\/)+([A-Za-z0-9-_. ]+\\.(inc|php))? ", | |
"color": "#ff00ff" | |
}, | |
"file-number": { | |
"pattern": "\\/([A-Za-z0-9-_.]+\\/)+([A-Za-z0-9-_. ]+\\.(inc|php))?:", | |
"color": "#008000" | |
}, | |
"line-number": { | |
"pattern": ":\\d+", | |
"color": "#d60000" | |
}, | |
"line-number-bracket": { | |
"pattern": "(\\(\\d+\\))\\s?:", | |
"color": "#d60000" | |
}, | |
"on-line": { | |
"pattern": "on line \\d+", | |
"color": "#ff0000", | |
"underline": true | |
} | |
}, | |
"sample": [ | |
{ "line": "[28-Nov-2019 15:57:19 Asia/Tokyo] PHP Deprecated: E_USER_DEPRECATED in /file/some/folder/html/php_strict_types.php on line 10", "level": "info" }, | |
{ "line": "[28-Nov-2019 15:57:19 Asia/Tokyo] PHP Notice: E_USER_NOTICE in /file/some/folder/html/php_strict_types.php on line 10", "level": "error" }, | |
{ "line": "[28-Nov-2019 15:57:19 Asia/Tokyo] PHP Warning: E_USER_WARNING in /file/some/folder/html/php_strict_types.php on line 11", "level": "warning" }, | |
{ "line": "[28-Nov-2019 15:57:19 Asia/Tokyo] PHP Fatal error: E_USER_ERROR in /file/some/folder/html/php_strict_types.php on line 12", "level": "fatal" }, | |
{ "line": "[28-Nov-2019 15:57:19 Asia/Tokyo] PHP Fatal error: Uncaught ArgumentCountError: strstr() expects at least 2 parameters, 0 given in /file/some/folder/html/php_strict_types.php:9", "level": "fatal" }, | |
{ "line": "[29-Nov-2019 13:31:50 Asia/Tokyo] PHP Parse error: syntax error, unexpected '=', expecting ')' in Command line code on line 1", "level": "critical" }, | |
{ "line": "[28-Nov-2019 15:57:19 Asia/Tokyo] PHP Dump $_SERVER" }, | |
{ "line": "[28-Nov-2019 15:57:19 Asia/Tokyo] PHP Stack trace:" }, | |
{ "line": "[28-Nov-2019 15:57:19 Asia/Tokyo] PHP 1. {main}() /file/some/folder/html/php_strict_types.php:0" }, | |
{ "line": "[28-Nov-2019 15:57:19 Asia/Tokyo] PHP " } | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment