fluentd icon indicating copy to clipboard operation
fluentd copied to clipboard

in_tcp and in_syslog fail with LoadError unless oj gem is installed

Open hagenmt opened this issue 2 years ago • 3 comments

Describe the bug

Unless I install oj gem then I get: 2024-01-16 17:08:59 +0000 [warn]: [in_tcp] LoadError 2024-01-16 17:08:59 +0000 [warn]: [in_syslog] LoadError

and my logs fail to ship

To Reproduce

<source>
  @type tcp
  @id in_tcp
  tag my_json
  port 24226
  bind 0.0.0.0
  <parse>
    @type json
  </parse>
</source>

Expected behavior

gem install fluentd should have the required gems in order to run

Your Environment

- Fluentd version: 1.16.3
- TD Agent version:
- Operating system: amazonlinux:2023
- Kernel version:

Your Configuration

<source>
  @type tcp
  @id in_tcp
  tag my_json
  port 24226
  bind 0.0.0.0
  <parse>
    @type json
  </parse>
</source>

<source>
  @type syslog
  @id in_syslog
  tag my_syslog
  port 24227
  bind 0.0.0.0
  <parse>
    @type json
  </parse>
</source>

Your Error Log

2024-01-16 17:08:59 +0000 [warn]: [in_tcp] LoadError
2024-01-16 17:08:59 +0000 [warn]: [in_syslog] LoadError

Additional context

https://rubygems.org/gems/fluentd

says oj is a development but not runtime requirement, seems a runtime requirement to me

hagenmt avatar Jan 16 '24 17:01 hagenmt

Even though oj is not runtime requirement, but try to load whether it is available or not. If oj is not available, it fallback to yajl.

https://github.com/fluent/fluentd/blob/master/lib/fluent/plugin/parser_json.rb#L50-L66

But it seems that fallback doesn't succeed. Is yajl or json available on your environment?

kenhys avatar Jan 23 '24 10:01 kenhys

If I add both but not oj gem install yajl json

It still fails with loaderror

hagenmt avatar Jan 23 '24 16:01 hagenmt

This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 7 days

github-actions[bot] avatar Feb 23 '24 10:02 github-actions[bot]

This issue was automatically closed because of stale in 7 days

github-actions[bot] avatar Mar 02 '24 10:03 github-actions[bot]