Socket
Socket
Sign inDemoInstall

logstash-client

Package Overview
Dependencies
5
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    logstash-client

General logstash client with multiple transport support


Version published
Maintainers
3
Install size
190 kB
Created

Readme

Source

logstash-client Build Status Coverage Status

General purpose logstash with multiple transport support

Features

  • tcp uses juliangruber's reconnect-net for handling reconnection
  • logging library independent (there are some logstash clients for winston, bunyan etc)

TODOS

  • TCP Transport
  • UDP Transport
  • Memory Transport (for testing)
  • AMQP Transport
  • Codec support

Example

var Logstash = require('logstash-client');

var logstash = new Logstash({
  type: 'udp', // udp, tcp, memory
  host: 'logstash.example.org',
  port: 13333
});
logstash.send(message [, callback]);

API

Constructor

Takes the following parameters:

  • type: type of connection, currently supported tcp, udp, memory
  • host: remote hostname
  • port: remote port
  • format (optional): formatter function (by default the message gets JSON.stringified)
  • maxQueueSize (optional): Restricts the amount of messages queued when there is no connection. If not specified the queue is not limited in size.

Example:

new Client({
  type: 'tcp',
  host: 'logstash.example.org',
  port: 8099,
  format: function(message) {
    message.formattedAt = new Date();
    message.password = '!FILTERED!';
    return JSON.stringify(message, null, 2);
  },
  maxQueueSize: 1000
});

Client#send

Takes the following parameters:

  • message: an object what you are trying to send to your logstash instance
  • callback (optional): a function called when the message has been sent

Example:

var client = new Client({
  type: 'tcp',
  host: 'example.org',
  port: 1337
});
client.send({
  '@timestamp': new Date(),
  'message': 'Important',
  'level': 'error'
});

License

MIT

Keywords

FAQs

Last updated on 29 Sep 2016

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc