logstash-client
Version:
General logstash client with multiple transport support
19 lines (16 loc) • 422 B
JavaScript
// start a server: node -e "require('dgram').createSocket('udp4').on('message', function(m){console.log(m + ''); }).bind(8008)"
var Client = require('..').Client;
var c = new Client({
host: 'localhost',
port: 8008,
type: 'udp'
});
var i = 0;
function send() {
setTimeout(function() {
var msg = {date: new Date(), attempt: ++i};
c.send(msg);
send();
}, Math.round(Math.random() * 10000));
}
send();