BUNYAN(1)

πŸ“¦ version 2.0.5+~cs4.4.3, in debian bookworm, ubuntu jammy, ubuntu noble

πŸ’– BUNYAN(1) β€” the bunyan manual, section 1 πŸ’–

okay bestie, buckle up β€” this is the manual page for bunyan, and yes it lives in section 1 of the manual. it's a whole vibe. let's get into it πŸ¦‹


✨ NAME ✨

bunyan β€” filter and pretty-print Bunyan log file content. that's it, that's the job, and she does it flawlessly πŸ’…


🌸 SYNOPSIS 🌸

bunyan [OPTIONS]

... | bunyan [OPTIONS]

bunyan [OPTIONS] -p PID

three whole ways to run her. pick your fighter ✨


πŸ‘‘ DESCRIPTION πŸ‘‘

so. "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 is describing the latter β€” the CLI tool. not the library. the tool. iykyk πŸŽ€

🧚 Pretty-printing

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 🌈

πŸ” Filtering

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

periodt. filter your logs, live your life πŸ’œ


✨ OPTIONS ✨

  • -h, --help β€” print this help info and exit. classic, iconic, does exactly what it says 🫢
  • --version β€” print version of this command and exit. know your queen's number πŸ’…
  • -q, --quiet β€” don't warn if input isn't valid JSON. shhh. no notes. 🀫

Dtrace options (only on dtrace-supporting platforms, so like, not everywhere bestie):

  • -p PID, -p NAME β€” process bunyan:log-* probes from the process with the given PID. can be used multiple times, or specify all processes with *, or a set of processes whose command & args match a pattern with -p NAME. multitasking queen πŸ”₯

Filtering options:

  • -l, --level LEVEL β€” only show messages at or above the specified level. you can specify level names or numeric values. (see "Log Levels" below.) πŸ“ˆ
  • -c COND, --condition COND β€” run each log message through the condition and only show those that resolve to a truish value. e.g. -c 'this.pid == 123'. it's giving selective ✨
  • --strict β€” suppress all but legal Bunyan JSON log lines. by default non-JSON, and non-Bunyan lines are passed through. strict queen behavior, honestly πŸ‘‘

Output options:

  • --color β€” colorize output. defaults to try if output stream is a TTY. 🌈
  • --no-color β€” force no coloring (e.g. terminal doesn't support it). sad but valid πŸ₯²
  • -o FORMAT, --output FORMAT β€” specify an output format. one of long (the default), short, json, json-N, bunyan (the native bunyan 0-indent JSON output) or inspect. pick a lane bestie, they're all cute πŸ’–
  • -j β€” shortcut for -o json. because typing is hard and you're busy ⚑
  • -L, --time local β€” display the time field in local time, rather than the default UTC time. timezone representation, we love to see it πŸ•

πŸŽ€ LOG LEVELS πŸŽ€

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.

  • trace β€” level number 10 β€” symbol in COND scripts: TRACE
  • debug β€” level number 20 β€” symbol in COND scripts: DEBUG
  • info β€” level number 30 β€” symbol in COND scripts: INFO
  • warn β€” level number 40 β€” symbol in COND scripts: WARN
  • error β€” level number 50 β€” symbol in COND scripts: ERROR
  • fatal β€” level number 60 β€” symbol in COND scripts: FATAL

numbers AND names, because she contains multitudes πŸ’œ


🌈 OUTPUT FORMATS 🌈

  • 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. (paul is lowkey an icon for this ngl πŸ™ˆ)
  • short β€” like the default output, but more concise. some typically redundant fields are ellided. minimalism, but make it logs ✨
  • 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. zero indent, maximum authenticity 🫢
  • inspect β€” Node.js util.inspect output.

πŸ”₯ DTRACE SUPPORT πŸ”₯

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. yes bestie, even if. read that twice πŸ“’

see https://github.com/trentm/node-bunyan#dtrace-support for more details and the -p PID option above for convenience usage.


πŸ¦‹ ENVIRONMENT πŸ¦‹

  • BUNYAN_NO_COLOR β€” set to a non-empty value to force no output coloring. see --no-color. it's the vibe-killer setting, but sometimes you need it πŸ₯²

πŸ’€ PROJECT & BUGS πŸ’€

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".

found a bug? tell the internet. she's listening 🎧


πŸ“œ LICENSE πŸ“œ

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.


okay that's the whole page bestie, no cap. this was the bunyan manual (that's the manual name, folded in nice and cozy near the top like i promised 🫢), and the footer energy: January 2015, source/version bunyan. that's a wrap, you ate, go pretty-print something βœ¨πŸ’…πŸŽ€

πŸ“¦ where this page comes from