BUNYAN(1) | bunyan manual | BUNYAN(1) |
bunyan - filter and pretty-print Bunyan log file content
bunyan [OPTIONS]
... | bunyan [OPTIONS]
bunyan [OPTIONS] -p PID
"Bunyan" is a simple and fast a JSON logging library for node.js services, a one-JSON-object-per-line log format, and a bunyan CLI tool for nicely viewing those logs. This man page describes the latter.
A bunyan log file is a stream of JSON objects, optionally interspersed with non-JSON log lines. The primary usage of bunyan(1) is to pretty print, for example:
$ bunyan foo.log # or `cat foo.log | bunyan [2012-02-08T22:56:52.856Z] INFO: myservice/123 on example.com: My message
extra: multi
line [2012-02-08T22:56:54.856Z] ERROR: myservice/123 on example.com: My message
By default the "long" output format is used. Use the -o FORMAT option to emit other formats. E.g.:
$ bunyan foo.log -o short 22:56:52.856Z INFO myservice: My message
extra: multi
line 22:56:54.856Z ERROR myservice: My message
These will color the output if supported in your terminal. See "OUTPUT FORMATS" below.
The bunyan CLI can also be used to filter a bunyan log. Use -l LEVEL to filter by level:
$ bunyan foo.log -l error # show only ´error´ level records [2012-02-08T22:56:54.856Z] ERROR: myservice/123 on example.com: My message
Use -c COND to filter on a JavaScript expression returning true on the record data. In the COND code, this refers to the record object:
$ bunyan foo.log -c `this.three` # show records with the ´extra´ field [2012-02-08T22:56:52.856Z] INFO: myservice/123 on example.com: My message
extra: multi
line
Dtrace options (only on dtrace-supporting platforms):
Filtering options:
Output options:
In Bunyan log records, then level field is a number. For the -l|--level argument the level names are supported as shortcuts. In -c|--condition scripts, uppercase symbols like "DEBUG" are defined for convenience.
Level Name Level Number Symbol in COND Scripts trace 10 TRACE debug 20 DEBUG info 30 INFO warn 40 WARN error 50 ERROR fatal 60 FATAL
FORMAT NAME DESCRIPTION long (default) The default output. Long form. Colored and "pretty".
´req´ and ´res´ and ´err´ fields are rendered specially
as an HTTP request, HTTP response and exception
stack trace, respectively. For backward compat, the
name "paul" also works for this. short Like the default output, but more concise. Some
typically redundant fields are ellided. json JSON output, 2-space indentation. json-N JSON output, N-space indentation, e.g. "json-4" bunyan Alias for "json-0", the Bunyan "native" format. inspect Node.js `util.inspect` output.
On systems that support DTrace (e.g., MacOS, FreeBSD, illumos derivatives like SmartOS and OmniOS), Bunyan will create a DTrace provider (bunyan) that makes available the following probes:
log-trace log-debug log-info log-warn log-error log-fatal
Each of these probes has a single argument: the string that would be written to the log. Note that when a probe is enabled, it will fire whenever the corresponding function is called, even if the level of the log message is less than that of any stream.
See https://github.com/trentm/node-bunyan#dtrace-support for more details and the ´-p PID´ option above for convenience usage.
bunyan is written in JavaScript and requires node.js (node). The project lives at https://github.com/trentm/node-bunyan and is published to npm as "bunyan".
MIT License (see https://github.com/trentm/node-bunyan/blob/master/LICENSE.txt)
node-bunyan is Copyright (c) 2012 Joyent, Inc. Copyright (c) 2012 Trent Mick. All rights reserved.
January 2015 |