# bunyan-seq

> A Bunyan stream that sends log events to Seq

Latest version **1.0.0** (published 2023-05-03) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install bunyan-seq
pnpm add bunyan-seq
yarn add bunyan-seq
bun add bunyan-seq
```

Provides the command `bunyan-seq`.

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2023-05-03 |
| First published | 2016-03-28 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=14.0.0 |
| Dependencies | 3 |
| Unpacked size | 31.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | Datalust and contributors |
| Maintainers | nblumhardt, seq |
| Keywords | bunyan, seq |

## Links

- npm: https://www.npmjs.com/package/bunyan-seq
- Repository: https://github.com/datalust/bunyan-seq
- Homepage: https://github.com/datalust/bunyan-seq#readme
- Issues: https://github.com/datalust/bunyan-seq/issues
- npm.io page: https://npm.io/package/bunyan-seq

## Dependencies (3)

- [split2](https://npm.io/package/split2.md) ^3.1.1
- [commander](https://npm.io/package/commander.md) ^5.1.0
- [seq-logging](https://npm.io/package/seq-logging.md) ^2.0.0

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2023-05-03
- 0.11.0 — 2021-08-20
- 0.10.0 — 2021-07-19
- 0.9.0 — 2021-07-16
- 0.8.0 — 2021-07-13
- 0.7.0 — 2021-03-11
- 0.6.0 — 2021-02-05
- 0.5.0 — 2020-12-08
- 0.4.0 — 2019-02-11
- 0.3.2 — 2018-12-17
- 0.3.1 — 2018-11-11
- 0.3.0 — 2018-10-23
- 0.2.0 — 2017-09-08
- 0.1.5 — 2016-09-28
- 0.1.4 — 2016-05-03
- … 5 more at https://npm.io/package/bunyan-seq/versions

## README

# bunyan-seq ![Build](https://github.com/datalust/bunyan-seq/workflows/Test/badge.svg) ![Publish](https://github.com/datalust/bunyan-seq/workflows/Publish/badge.svg) [![NPM](https://img.shields.io/npm/v/bunyan-seq.svg)](https://www.npmjs.com/package/bunyan-seq)

A Bunyan stream to send events to [Seq](https://datalust.co/seq). Tested with Node.js versions 4.2.2 and up.

## Usage

First, install `bunyan-seq` as a global tool:

```shell
npm install -g bunyan-seq
```

Then, pipe the output of your bunyan-enabled app to it:

```shell
node your-app.js | bunyan-seq --serverUrl http://localhost:5341 --apiKey 1234567890  --property application=ExampleApp
```

`bunyan-seq` accepts the following parameters:

- `serverUrl` - this is the base URL of your Seq server; if omitted, the default value of `http://localhost:5341` will be used
- `apiKey` - your Seq API key, if one is required; the default does not send an API key
- `logOtherAs` - log other output (not formatted through bunyan) to seq at this loglevel. Useful to capture messages if the node process crashes or smilar.
- `property` - add additional properties to all logs sent to Seq

### Structured logging with message templates

You can specify property names as tokens in the log message to control how the event is rendered in Seq:

```js
// Seq will render this as 'Hi, Alice!'
log.info({ user: 'Alice' }, 'Hi, {user}!');
```

The full message template syntax is documented [here](https://messagetemplates.org).

### Capturing other output

To enable capture of output not formatted through bunyan use the `logOtherAs` parameter. It's possible to use different settings for `STDOUT`/`STDERR` like this, when using bash:

```shell
node your-app.js `
    2> >(bunyan-seq --logOtherAs Error --serverUrl http://localhost:5341 --apiKey 1234567890) `
    > >(bunyan-seq --logOtherAs Information --serverUrl http://localhost:5341 --apiKey 1234567890)
```

## In-process usage

Use the `createStream()` method to create a Bunyan stream configuration, passing `serverUrl`, `apiKey` and batching parameters.

```js
let bunyan = require('bunyan');
let seq = require('bunyan-seq');

var log = bunyan.createLogger({
  name: 'myapp',
  streams: [
    {
      stream: process.stdout,
      level: 'warn'
    },
    seq.createStream({
      serverUrl: 'http://localhost:5341',
      level: 'info',
      reemitErrorEvents: true,
      onError: (e) => {
        console.error('[SeqStreamCustomError] failed to log events:', e);
      }
    })
  ]
});

log.info('hi');
log.warn({ lang: 'fr' }, 'au revoir');
```

Read the [complete documentation](https://docs.datalust.co/docs/using-nodejs).

---
_Source: https://npm.io/package/bunyan-seq · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
