Socket
Socket
Sign inDemoInstall

simple-udp-stream

Package Overview
Dependencies
1
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    simple-udp-stream

Writable stream over UDP


Version published
Weekly downloads
9
Maintainers
1
Install size
109 kB
Created
Weekly downloads
 

Readme

Source

simple-udp-stream

Build status Dependencies status

Basic usage

var SimpleUdpStream = require('simple-udp-stream');

var stream = new SimpleUdpStream({
  destination: '127.0.0.1',
  port: 9999
});

stream.write("Hello World!");

Wireshark simple capture

Bunyan and logstash

Configure logstash to listen to UDP logs:

input {
  udp {
     port => 9999
     codec => json
  }
}
output {
  elasticsearch {
    host => localhost
    protocol => http
  }
}

Configure bunyan to log over UDP:

var bunyan = require('bunyan');

var logger = bunyan.createLogger({
  name: 'my-logger',
  streams: [{
    level: 'info',
    stream: require('simple-udp-stream')({
      destination: '127.0.0.1',
      port: 9999
    })
  }]
});

logger.info({ value: 1 }, "Hello World!");

Kibana capture

Wireshark bunyan capture

Limitations

IPv4 only for now. Open a GitHub issue if that is an issue for you. IPv6 support should be easy to add.

Message size is limited by the smallest MTU between source and destination: see Node.js documentation.

If a message is too big, it will simply be dropped...

Keywords

FAQs

Last updated on 12 Apr 2015

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