bunyan - filter and pretty-print Bunyan log file content
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.
bunyan CLI can also be used to filter a bunyan log. Use
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
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
Print this help info and exit.
Print version of this command and exit.
Don't warn if input isn't valid JSON.
Dtrace options (only on dtrace-supporting platforms):
Only show messages at or above the specified level. You can specify level names or numeric values. (See 'Log Levels' below.)
Run each log message through the condition and only show those that
resolve to a truish value. E.g.
-c 'this.pid == 123'.
Suppress all but legal Bunyan JSON log lines. By default non-JSON, and non-Bunyan lines are passed through.
Colorize output. Defaults to try if output stream is a TTY.
Force no coloring (e.g. terminal doesn't support it)
Specify an output format. One of
long (the default),
bunyan (the native bunyan 0-indent JSON output) or
Display the time field in local time, rather than the default UTC time.
In Bunyan log records, then
level field is a number. For the
argument the level names are supported as shortcuts. In
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 (
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.
node). The project
lives at https://github.com/trentm/node-bunyan and is published to npm as
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.