A simple log prettifier extensible with syntax parsers for various log formats.
Components are log entries are colored for easy skimming, and data parts are printed as pretty JSON.
tail -f /var/log/php5-fpm.log | prettylog
To print only messages matching or above the specified monolog level (see RFC5424):
--min-level="debug|info|notice|warning|error|critical|alert|emergency"
Alternative short syntax:
-l debug|info|notice|warning|error|critical|alert|emergency
When filtered for log level, prettylog will print a dot for each omitted log message. Disable this by:
--no-dots
prettylog will also add a yellow "time gap" line between log entries that are more than 30 seconds apart. Disable this by:
--no-gaps
To highlight text in the output (ANSI mode only) use the --hilite (or -H) option:
--hilite=text
--hilite='some words'
You can also provide regular expressions (following the PCRE syntax if you start the hilite value with a slash / and end it with / or /i (for case-insensitive):
--hilite='/reg(ular)? ?ex(pression)?/i'
To print the usage and options:
--help
Currently there are parsers for:
- monolog
LineFormatterandJsonFormattersyntax (such as Symfony application logs) - php-fpm logs
- syslog files
As part of my daily routine I tend to deal with the following log formats too, so I will probably add parsers for:
- nginx access and error logs (need to add support for multi-line log entries)
- supervisor logs
This is an early release. Use at your own risk. Comments and suggestions are welcome.
Install composer:
curl -sS https://getcomposer.org/installer | php
Install box:
curl -LSs https://box-project.github.io/box2/installer.php | php
sudo mv box.phar /usr/local/bin/box
chmod 755 /usr/local/bin/box
Build:
box build