fluentd-docs-gitbook icon indicating copy to clipboard operation
fluentd-docs-gitbook copied to clipboard

`<parse>` and `<extract>` sections are required for in_exec

Open nokute78 opened this issue 3 years ago • 0 comments

Describe the bug

I tested in_exec using latest master Refer to document, <parse> and <extract> are not required.

However below configuration causes error since keys of <parse> is missing. [error]: config error file="../b.conf" error_class=Fluent::ConfigError error="'keys' parameter is required"

$ bundle exec bin/fluentd  -c ../b.conf 
2022-01-22 07:53:01 +0900 [info]: parsing config file is succeeded path="../b.conf"
2022-01-22 07:53:01 +0900 [info]: gem 'fluentd' version '1.14.4'
2022-01-22 07:53:01 +0900 [error]: config error in:
<parse>
</parse>

2022-01-22 07:53:01 +0900 [error]: config error file="../b.conf" error_class=Fluent::ConfigError error="'keys' parameter is required"

Link to the problematic documentation

https://docs.fluentd.org/input/exec#less-than-parse-greater-than-section https://docs.fluentd.org/input/exec#less-than-extract-greater-than-section

Expected explanation

In my understanding, <parse> and <extract> sections are required. I think below is minimum configuration for in_exec.

<source>
  @type exec
  command echo -n '{"foo": "bar", "tag":"aaa"}'
  <parse>
    @type json
  </parse>
  <extract>
    tag_key tag
  </extract>
</source>

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

Additional context

Below is error report if we execute without <extract> section. So I think <extract> section are also required.

$ bundle exec bin/fluentd  -c ../b.conf 
2022-01-22 07:57:07 +0900 [info]: parsing config file is succeeded path="../b.conf"
2022-01-22 07:57:07 +0900 [info]: gem 'fluentd' version '1.14.4'
2022-01-22 07:57:07 +0900 [error]: config error file="../b.conf" error_class=Fluent::ConfigError error="'tag' or 'tag_key' option is required on exec input"
<source>
  @type exec
  command echo -n '{"foo": "bar", "tag":"aaa"}'
  <parse>
    @type json
  </parse>
</source>

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

nokute78 avatar Jan 21 '22 23:01 nokute78