Socket
Socket
Sign inDemoInstall

pino-socket

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pino-socket

A pino 'transport' for writing to a tcp or udp socket


Version published
Weekly downloads
2.9K
decreased by-33.77%
Maintainers
1
Weekly downloads
 
Created
Source

pino-socket

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

Given an application foo that logs via pino, and a system that collects logs on port UDP 5000 on IP 10.10.10.5, you would use pino-socket like so:

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

Options

  • --settings (-s): read settings from a JSON file (switches take precedence)
  • --address (-a): the address for the destination socket. Default: 127.0.0.1.
  • --mode (-m): either tcp or udp. Default: udp.
  • --port (-p): the port for the destination socket. Default: 514.
  • --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": "127.0.0.1",
  "port": 514,
  "mode": "tcp",
  "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": "10.0.0.5",
  "port": 514
}

And the command line:

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

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

License

MIT License

Keywords

FAQs

Package last updated on 07 Sep 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc