NASA Proceeds to Mars


    5.0.0 • Public • Published


    npm version Build Status Known Vulnerabilities js-standard-style

    Lead maintainer: jsumners

    This module provides a "transport" for pino that simply forwards messages to an arbitrary socket. The socket can be UDPv4 or TCPv4. The module can echo the received logs or work silently.

    You should install pino-socket globally for ease of use:

    $ npm install --production -g pino-socket

    Usage as Pino Transport

    You can use this module as a pino transport like so:

    const pino = require('pino')
    const transport = pino.transport({
      target: 'pino-socket',
      options: {
        address: '',
        port: 5000.
        mode: 'tcp'

    All options are described further below. Note that the echo option is disabled within this usage.

    Usage as Pino Legacy Transport

    Pino supports a legacy transport interface that is still supported by this module. Given an application foo that logs via pino, and a system that collects logs on port UDP 5000 on IP, you would use pino-socket like so:

    $ node foo | pino-socket -a -p 5000


    $ node foo | pino-socket -u /tmp/unix.sock


    • --settings (-s): read settings from a JSON file (switches take precedence)
    • --unixsocket (-u): the unix socket path for the destination. Default: ``.
    • --address (-a): the address for the destination socket. Default:
    • --port (-p): the port for the destination socket. Default: 514.
    • --mode (-m): either tcp or udp. Default: udp.
    • --secure (-tls): enable secure (TLS) connection for TCP (only works with --mode=tcp).
    • --noverify (-nv): allow connection to server with self-signed certificates (only works with --secure).
    • --reconnect (-r): enable reconnecting to dropped TCP destinations. Default: off
    • --reconnectTries <n> (-t <n>): set number (<n>) of reconnect attempts before giving up. Default: infinite
    • --echo (-e): echo the received messages to stdout. Default: enabled.
    • --no-echo (-ne): disable echoing received messages to stdout.

    Settings JSON File

    The --settings switch can be used to specify a JSON file that contains a hash of settings for the the application. A full settings file is:

      "address": "",
      "port": 514,
      "mode": "tcp",
      "secure": false,
      "noverify": false,
      "reconnect": true,
      "reconnectTries": 20,
      "echo": false

    Note that command line switches take precedence over settings in a settings file. For example, given the settings file:

      "address": "",
      "port": 514

    And the command line:

    $ yes | pino-socket -s ./settings.json -p 1514

    The connection will be made to address on UDP port 1514.


    MIT License



    npm i pino-socket

    DownloadsWeekly Downloads






    Unpacked Size

    38.4 kB

    Total Files


    Last publish


    • davidmarkclements
    • matteo.collina
    • jsumners
    • watson