I am consistently observing that 10-to-50% of log messages that are logged in rapid succession are lost/dropped (i.e. never make it to the network). I am using bunyan and bunyan-logstash-tcp. I am monitoring the network using wireshark and I never see all of the log messages get on the network - only a few of them. If I reduce the number of log messages to say three messages instead of 6 or more, all the log messages *usually* appear. This happens on windows and on linux. I should be using the latest of all packages as I just downloaded them into a new test project. I have double and triple checked the Elasticsearch/Logstash/Kibana stack and I am confident there is nothing wrong there that could be causing this (especially since I don't even see all the log messages make it to the network in wireshark). Please let me know if any suggestions.
var logTestMessages = function() {
console.log('Logger connected.');
logger.error("KK45 - This is a error from the tester");
logger.debug("KK46 - This is a debug from the tester");
logger.info("KK47 - Heres some info");
logger.error("KK56 - This is a error from the tester");
logger.debug("KK57 - This is a debug from the tester");
logger.info("KK58 - Heres some info");
logger.error("KK67 - This is a error from the tester");
logger.debug("KK68 - This is a debug from the tester");
logger.info("KK69 - Heres some info");
logger.error("KK70 - This is a error from the tester");
logger.debug("KK71 - This is a debug from the tester");
logger.info("KK72 - Heres some info");
console.log("Done");
};
var LogstashLogger = require('./Logger');
var logger = LogstashLogger.getLogger("LoggerTester", logTestMessages);
=================
=================
Logger.js
=================
"use strict";
var bunyan = require('bunyan')
var bunyantcp = require('bunyan-logstash-tcp');
exports.getLogger = function(name, initializationCompleteCallback)
{
var log = bunyan.createLogger({
name: name,
streams: [{
level: 'debug',
type: "raw",
stream: bunyantcp.createStream({
host: '100.110.120.130',
port: 9998
}).on('error', console.log).on('connect', function() {
console.log('bunyan tcp stream connected.');
initializationCompleteCallback();
})
}],
level: 'debug'
});
console.log('bunyan logger connected.');
return log;
};