Skip to content
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

null value fields are dropped from JSON decoding #5522

Closed
PhaedrusTheGreek opened this issue Nov 6, 2017 · 10 comments · Fixed by #13928
Closed

null value fields are dropped from JSON decoding #5522

PhaedrusTheGreek opened this issue Nov 6, 2017 · 10 comments · Fixed by #13928
Assignees
Labels
Filebeat Filebeat good first issue Indicates a good issue for first-time contributors

Comments

@PhaedrusTheGreek
Copy link
Contributor

  • Filebeat 5.6.1 under OSX

Given a file like this:

{"test-null": null, "@timestamp":"2016-11-01T14:39:36.322", "type": 42,  "level":"INFO", "message":"test"}

With the following FB config:

filebeat.registry_file: /tmp/reg
filebeat.prospectors:

- paths:
    - /path/to/json-data.json
  json.keys_under_root: false
  close_eof: true

output.elasticsearch:
  hosts: ["http://localhost:9200"]

logging.level: debug

The test-null field is dropped before being sent to ES:

 {
        "_index": "filebeat-2017.11.06",
        "_type": "doc",
        "_id": "AV-SYVk_9oC3GfO5heZP",
        "_score": 1,
        "_source": {
          "@timestamp": "2017-11-06T17:29:29.150Z",
          ...
          "input_type": "log",
          "json": {
            "@timestamp": "2016-11-01T14:39:36.322",
            "level": "INFO",
            "message": "test",
            "type": 42
          },
          "offset": 1075,
          "source": "/path/to/json-data.json",
          "type": "log"
        }
      }

While hoping to make use of Elasticsearch's null_value mapping parameter.

@PhaedrusTheGreek PhaedrusTheGreek added the Filebeat Filebeat label Nov 6, 2017
@andrewkroh
Copy link
Member

It's probably not the JSON decoder. Beats drop null values as part of the output process.

@ph
Copy link
Contributor

ph commented Nov 7, 2017

@andrewkroh The null value mapping is an handy settings we could allow user to configure that behavior? @PhaedrusTheGreek an ingest pipeline could be a workaround for now, the downside is this might be more costly on space than the null value mapping? I don't know how this is implemented.

@PhaedrusTheGreek
Copy link
Contributor Author

Yes, we could workaround in Logstash, but there is a lot of re-determination of information already present then lost from the original JSON document that would lead to inefficiencies in processing, space savings, maintenance/management, etc. We might prefer to wait for a fix if it's foreseeable.

@ph ph self-assigned this Nov 9, 2017
@ph
Copy link
Contributor

ph commented Nov 13, 2017

@ph
Copy link
Contributor

ph commented Dec 5, 2017

Just to update this issue, we have decided to keep the current behavior as the default and add an opt-in flag to retain null values.

@gmoskovicz
Copy link

@ph

add an opt-in flag to retain null values.

What PR was this added in ?

@StephenOTT
Copy link

Was this added? @ph

@Zoya-bhavya
Copy link

i am sending my json to logsatsh why do event is dropped at filebeat ? how to handle it ?

@ph
Copy link
Contributor

ph commented Jun 11, 2018

Not yet, I will resurrect that.

@Screamik
Copy link

Screamik commented Feb 26, 2019

Hello, guys!
Any news about the workaround for the issue? @ph

@kvch kvch added the good first issue Indicates a good issue for first-time contributors label Apr 18, 2019
@ph ph removed their assignment Oct 4, 2019
@ycombinator ycombinator self-assigned this Oct 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Filebeat Filebeat good first issue Indicates a good issue for first-time contributors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants