Logtail Bunyan stream

Start logging in 3 steps

1. Install

Install Logtail Bunyan and Logtail Node NPM packages:

Install Logtail packages
npm install @logtail/bunyan @logtail/node

2. Setup

Set up Logtail Bunyan stream:

Set up Bunyan logger
const bunyan = require("bunyan");
const { Logtail } = require("@logtail/node");
const { LogtailStream } = require("@logtail/bunyan");

// Create Logtail client
const logtail = new Logtail("$SOURCE_TOKEN");

// Create Bunyan logger
const logger = bunyan.createLogger({
  name: "Example logger",
  level: "debug",
  streams: [
      stream: new LogtailStream(logtail),

3. Start logging ๐ŸŽ‰

Use Bunyan logger as usual:

Send logs to Logtail
logger.error("Something bad happened.");
    item: "Orange Soda",
    price: 100.00
}, "Log message with structured logging.");

// Ensure that all logs are sent to Logtail

You should see your logs in Logtail โ†’ Live tail.

Bunyan version 2.0.0 or higher is required.

Need help?

Please let us know at hello@betterstack.com.
We're happy to help! ๐Ÿ™

Other Logtail clients

Looking for a different JavaScript logging solution? Check out Logtail clients for JavaScript and Node.js.