-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
short_message not appearing #5
Comments
From the appender code, I can't see why |
I've gotten a little further with debugging this. The problem is layered, with small issues with my config, the logstash gelf input plugin, and this appender all conflating into a tricky-to-unpick situation. This extremely long comment walks through the whole thing and ends with a proposed small change to the appender. First here's my minimal node snippet:
My logstash config did have a bunch of filters, including a mutation to remove
Given this config, I'm expecting messages to come through with a This explains why they weren't appearing before, the mutation to remove This is due to the code in the logstash gelf input plugin: https://github.com/logstash-plugins/logstash-input-gelf/blob/master/lib/logstash/inputs/gelf.rb#L264
If @log4js-node/gelf doesn't have support for In order to get to the behaviour I'm looking for, I need to be able to send full_message. Unfortunately, given the way @log4js-node/gelf is written, this is currently not possible - even if I set I believe the easiest fix would be to change the customField code slightly, to have a list of allowed gelf fields that can be passed through without an underscore. This is the same approach as is used in gelfling: list of fields: https://github.com/mhart/gelfling/blob/master/gelfling.js#L8 @nomiddlename would you be up for pushing out this change if I PR it? |
I don't think the GELF appender is doing anything wrong here, according to the GELF payload spec. I'm not trying to avoid making changes in this library, just trying to make sure we make the right ones - at the moment this sounds like a very specific problem that's related to the way your logstash is configured and I don't know how widely this applies. |
Oh, there's also the logstashUDP appender for log4js which might help you. Or at least give you a whole different set of problems :) |
What I’m proposing is a 2 line change adding support for this part of the spec in a backwards compatible way, that will save me an inordinate about of work. To provide context, the point of my work is trying to swap the now unmaintained Bunyan for a new library in our incumbent infrastructure, which features many micro services and large numbers of instances. I’m trying to reach feature parity so that I don’t also have to handle incompatibilities in our existing elk stack whilst we roll this update across our full infra - and to reduce data inconsistencies. This bug and log4js-node/log4js-node#911 are currently blockers to us making the switch in Ghost. Happy to put in the leg work to PR the fix, but I’d really appreciate your support before sinking any more time into it. |
Ok, so a user would be able to do something like this? logger.info({ GELF: true, full_message: 'something really long' }, 'this is the short message'); Is that how you're going to use it? |
I'm in the process of testing out log4js-node as a replacement for bunyan, and checking that the gelf transport works as expected.
I'm using gelf to send data to logstash. It's working for the most part, except that
short_message
doesn't appear in kibana. If I change the code to use_short_message
instead, it works as expected. I've tried several different layouts - currently testing withdummy
, but I've testedbasic
and the default.My apender looks like this:
gelf: {type: '@log4js-node/gelf', host: 'xxx', port: 12201, facility: 'log-test', layout: {type: 'dummy'}, customFields: {_foo: 'bar'}}
This is really weird. The facility property gets sent correctly, timestamp, host, level etc all work.
According to the logstash docs
short_message
is expected, and it works with the existing bunyan setup.I can't see any important difference between the code in this repo vs the gelf-stream package used for bunyan.
I also checked gelf-stream's dep gelfling and it's not adding the
_
.I am still looking for configuration issues that could be causing this, but I'm pretty confused because the messages are being sent to a different index but the same server, with all the same config as the working bunyan version.
Any ideas?
The text was updated successfully, but these errors were encountered: