Not Able to specify timestamp with the message
gouthamkotcharlakota opened this issue · 0 comments
gouthamkotcharlakota commented
Hi,
I am using @log4js-node/gelf@1.0.2. I am sending a message with timestamp info, which is not being picked up by the module.
const log4js = require('log4js');
log4js.configure({
appenders: {
gelf: { type: '@log4js-node/gelf', host: 'localhost', port: '12201', }
},
categories: {
default: { appenders: ['gelf'], level: 'info' }
}
});
module.exports = log4js;
const logger = log4js.getLogger();
logger.info({ GELF: true, _tool: 'proxy-parser', _uniqueId: 'test', _timestamp: 1611283489 }, 'very very old message');
But the message is getting logged with the current timestamp on graylog.
Looks like the issue with this line
Line 95 in 4786403
It should have been
msg.timestamp = msg._timestamp || new Date().getTime() / 1000; // log should use millisecond
Can this be fixed?
Thank You,
Phani