pino-logdna

Transport pino logs to LogDNA

Usage no npm install needed!

<script type="module">
  import pinoLogdna from 'https://cdn.skypack.dev/pino-logdna';
</script>

README

pino-logdna

All Contributors

Transport pino logs to LogDNA

Install

npm install --save pino-logdna

Usage

Pino v7+ Transport

This module can be used as a pino transport:

const pino = require('pino')
const transport = pino.transport({
  target: 'pino-logdna',
  options: {
    key // your LogDNA ingestion key
  }
})

const log = pino(transport)

// Logs will now go to LogDNA
log.info('Happy Logging!')

Options

This transport uses @logdna/logger under the hood, and most options are exposed through pino-logdna.

For a full list, please see the createLogger options

Legacy Transport

Usage as a legacy transport is still supported. The minimal configuration requires only your LogDNA ingestion key:

npm install -g pino-logdna
node ./app.js | pino-logdna --key="YOUR INGESTION KEY"

CLI Options can be supplied to the command:

node ./app.js | pino-logdna --key "YOUR INGESTION KEY" --env staging --tag foo --tag bar

CLI Options

Options for the CLI are the kebab-case equivalent of the @logdna/logger options:

Options:
  -v, --version                   Show version
  -h, --help                      Show usage information
  -m, --message-key [msg]         The field in the `pino` used as the display line in LogDNA 

@logdna/logger Options:
      --key                       *REQUIRED* Your ingestion key
  -t, --tag                       Tag to be added to each message; can be supplied multiple times
  -T, --timeout [30000]           Millisecond timeout for each HTTP request
      --app [default]             Arbitrary app name for labeling each message
  -E, --env                       An environment label attached to each message
  -H, --hostname                  Hostname for each HTTP request
      --mac                       MAC address for each HTTP request
      --ip                        IPv4 or IPv6 address for each HTTP request
      --url                       URL of the logging server
      --flush-limit [5000000]     Maximum total line lengths before a flush is forced
      --flush-interval-ms [250]   Mseconds to wait before sending the buffer
      --base-backoff-ms [3000]    Minimum exponential backoff time in milliseconds
      --max-backoff-ms [30000]    Maximum exponential backoff time in milliseconds
      --index-meta [false]        Controls whether meta data for each message is searchable
  -p, --proxy                     The full URL of an http or https proxy to pass through

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Maciej Ziehlke


Mike Del Tito

💻 📖 💡 🔧

This project follows the all-contributors specification. Contributions of any kind welcome!

License

Copyright © LogDNA, released under an MIT license. See the LICENSE file and https://opensource.org/licenses/MIT

Happy Logging!