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

Regression: filter_parse type json is dropping events #1866

Closed
timosellin opened this issue Feb 21, 2018 · 1 comment
Closed

Regression: filter_parse type json is dropping events #1866

timosellin opened this issue Feb 21, 2018 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@timosellin
Copy link

timosellin commented Feb 21, 2018

My environment

  • Fluentd version: 1.1.0
  • Docker image: official fluent/fluentd:v1.1.0
  • OS on the Host: Ubuntu 16.04.3 LTS
  • Linux kernel: 4.13.0-32-generic
  • Docker version: 17.12.0-ce

How to reproduce

Config file

$ cat fluent.conf
<source>
  @type tail
  path /x.log
  read_from_head true
  tag docker.*
  <parse>
    @type json
    time_key time
    time_format %Y-%m-%dT%H:%M:%S.%N%Z
    localtime true
  </parse>
</source>

<filter docker.**>
  @type parser
  format json
  key_name log
  reserve_data true
  emit_invalid_record_to_error false
</filter>

<match **>
  @type stdout
</match>

Test data

This is the log file I am reading with tail:

$ cat x.log
{"log":"+ cat /etc/resolv.conf\n","stream":"stderr","time":"2018-02-20T14:26:51.656915333Z"}
{"log":"nameserver 127.0.0.11\n","stream":"stdout","time":"2018-02-20T14:26:51.666966175Z"}
{"log":"options timeout:1 ndots:0\n","stream":"stdout","time":"2018-02-20T14:26:51.666988017Z"}

Expected behavior

Fluentd 1.0.1 shows the expected behavior:

$ docker run --rm -ti -v $PWD/x.log:/x.log -v $PWD/fluent.conf:/fluentd/etc/fluent.conf -e "FLUENTD_OPT=-qq" fluent/fluentd:v1.0.1
2018-02-20 14:26:51.656915333 +0000 docker.x.log: {"log":"+ cat /etc/resolv.conf\n","stream":"stderr"}
2018-02-20 14:26:51.666966175 +0000 docker.x.log: {"log":"nameserver 127.0.0.11\n","stream":"stdout"}
2018-02-20 14:26:51.666988017 +0000 docker.x.log: {"log":"options timeout:1 ndots:0\n","stream":"stdout"}

Actual behavior

Fluentd 1.1.0 drops 2 events:

$ docker run --rm -ti -v $PWD/x.log:/x.log -v $PWD/fluent.conf:/fluentd/etc/fluent.conf -e "FLUENTD_OPT=-qq" fluent/fluentd:v1.1.0
2018-02-20 14:26:51.666966175 +0000 docker.x.log: {"log":"nameserver 127.0.0.11\n","stream":"stdout"}

Cause

Looks like the problem is caused by a 3rd-party dependency (oj). It has been introduced in
fluent/fluentd-docker-image@a5792ee#diff-106c3e6808cb07c5ed182eed25142b97

Diff:

- && gem install oj -v 2.18.3 \
+ && gem install oj -v 3.3.10 \

With oj 2.18.3 I see the expected behavior with oj 3.3.10 events are dropped.

@repeatedly
Copy link
Member

I confirmed this behaviour.
The problem is oj changes exception handling.
Will fix soon.

@repeatedly repeatedly self-assigned this Mar 1, 2018
@repeatedly repeatedly added the bug Something isn't working label Mar 1, 2018
repeatedly added a commit that referenced this issue Mar 2, 2018
parser_json: Add EncodingError to rescue list for oj 3.x. fix #1866
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants