log4js-node / log4js-node/gelf

short_message not appearing

Open
#5 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
5
Forks
10
PR merge metrics
No merged PRs in 30d

Description

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 with `dummy`, but I've tested `basic` 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](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-gelf.html#plugins-outputs-gelf-custom_fields) `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](https://github.com/log4js-node/gelf/blob/master/lib/index.js#L92) vs the [gelf-stream package used for bunyan](https://github.com/mhart/gelf-stream/blob/master/gelf-stream.js#L83).

I also checked gelf-stream's dep [gelfling](https://github.com/mhart/gelfling/blob/master/gelfling.js#L103) 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?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lib/index.js around line 92 and reproduce the issue using the shown GELF appender configuration and dummy layout. Compare the generated fields with gelf-stream.js around line 83 and gelfling.js around line 103, focusing on why short_message becomes unavailable while _short_message works. Done means the GELF output exposes short_message correctly in Logstash/Kibana.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.