Skip to content

parser_multiline: correct the formatN parameter table - #660

Merged
kenhys merged 1 commit into
fluent:1.0from
Watson1978:docs-multiline-formatn-table
Jul 31, 2026
Merged

parser_multiline: correct the formatN parameter table#660
kenhys merged 1 commit into
fluent:1.0from
Watson1978:docs-multiline-formatn-table

Conversation

@Watson1978

@Watson1978 Watson1978 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

What

Fix the formatN parameter table on parser/multiline.md:

  • default: `nil`required parameter
  • type: stringregexp

Why

The article states "It is a required parameter." right, yet the table listed nil as the default. A required parameter cannot have a default value, so the two descriptions contradicted each other.

formatN is also not declared as a config_param. In lib/fluent/plugin/parser_multiline.rb, only format_firstline and unmatched_lines are declared; format1 to format20 are read directly from the config element inside parse_formats. So the string / nil shown in the table had no basis in the config system.

formatN is validated as a regular expression by check_format_regexp.

      def check_format_regexp(format, key)
        if format[0] == '/' && format[-1] == '/'
          begin
            Regexp.new(format[1..-2], Regexp::MULTILINE)
          rescue => e
            raise Fluent::ConfigError, "Invalid regexp in #{key}: #{e}"
          end
        else
          raise Fluent::ConfigError, "format should be Regexp, need //, in #{key}: '#{format}'"
        end
      end

https://github.com/fluent/fluentd/blob/469d5c239113f36788046f6222d840aee8615047/lib/fluent/plugin/parser_multiline.rb#L139-L149

Note

This addresses the remaining point of #466. That issue raised two problems: the undocumented got incomplete line before first line warning (handled in #655) and this formatN table mismatch. #466 was closed after #655 was merged, so this PR references it for context only.

Refs #466

The table showed "nil" as the default for formatN, but the text right
below states it is a required parameter. A required parameter has no
default, so the two descriptions contradicted each other.

formatN is not a config_param either. Only format_firstline and
unmatched_lines are declared in parser_multiline.rb; format1 to format20
are read directly from the config element via conf["format#{i}"]. So the
string / nil shown in the table had no basis in the config system.

Align the table with the parent regexp parser page, where the required
regexp pattern "expression" is documented as "regexp | required
parameter". Keep the version (0.14.0), which matches when the multiline
parser plugin was introduced.

Refs fluent#466

Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
@Watson1978
Watson1978 requested a review from kenhys July 31, 2026 02:56
@kenhys
kenhys merged commit 9b908c9 into fluent:1.0 Jul 31, 2026
2 checks passed
@Watson1978
Watson1978 deleted the docs-multiline-formatn-table branch July 31, 2026 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants