Created
October 19, 2017 14:43
-
-
Save jthomas/168e828ce1a65f99d10c9130e9ec87a9 to your computer and use it in GitHub Desktop.
Pushing logs over Lumberjack protocol using Node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ docker run -p 5601:5601 -p 9200:9200 -p 5000:5000 -it --name old_elk sebp/elk:es241_l240_k461 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const lumberjack = require('lumberjack-protocol') | |
var connectionOptions = { | |
host: "localhost", | |
port: 5000, | |
rejectUnauthorized: false | |
}; | |
var client = lumberjack.client(connectionOptions); | |
client.on('connect', details => { | |
console.log('connected', details) | |
client._socket.on('ack', seq => { | |
console.log('ack', seq) | |
}) | |
client.writeDataFrame({"line": "2017-10-16T15:43:29.08404089Z stdout: aaaa"}); | |
client.writeDataFrame({"line": "2017-10-16T15:43:29.08404089Z stdout: aaaa"}); | |
client.writeDataFrame({"line": "2017-10-16T15:43:29.08404089Z stdout: aaaa"}); | |
client.writeDataFrame({"line": "2017-10-16T15:43:29.08404089Z stdout: aaaa"}); | |
}) | |
client.on('dropped', details => { | |
console.log('dropped', details) | |
}) | |
client.on('disconnect', details => { | |
console.log('disconnected', details) | |
}) | |
console.log('finished...') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment