Hi, I just recently tried your package with the following code snippet:
const graylog2 = require("graylog2");
const logger = new graylog2.graylog({
servers: [
{ "host": "52.136.248.240", port: 8514 }
],
// hostname: "test.name", // the name of this host
// (optional, default: os.hostname())
facility: "Banana.js", // the facility for these log messages
// (optional, default: "Node.js")
// bufferSize: 1350 // max UDP packet size, should never exceed the
// MTU of your system (optional, default: 1400)
});
logger.on("error", function (error) {
console.error("Error while trying to write to graylog2:", error);
});
logger.log("InvalidChecksum", JSON.stringify({ name: "Error", message: "The packet is corrupted. CRC-16-IBM not matching.", info: 1 }));
logger.close(function(){
console.log('All done - cookie now?');
process.exit();
});
So, as you can see, there are several things I ought to expect when check the graylog logs, like for example, the facility being “Banana.js”.
This however, is not the case. graylog2 seems to be unable to understand my log, and parses everything as a single string. I have attached a screenshot that exemplifies this:
From the image, you can see that a few things are not quite right:
- facility is Unknown
- level is -1
- If show the column “Full message”, it will be empty
The package is widely used, so I suppose this is a configuration issue.
- Am I missing something in my small code snippet?
- Is there any graylog2 configuration I need to make?