fluent/fluentd · error · Fluent::ConfigError
<secondary> section cannot have <buffer> section
Error message
<secondary> section cannot have <buffer> section
What it means
A `<buffer>` block was nested inside the `<secondary>` block. The secondary plugin is driven by the primary's buffer (it receives the primary's failed chunks), so it cannot define its own buffer section; the configuration parser finds `@secondary_config.buffer` set and rejects it.
Source
Thrown at lib/fluent/plugin/output.rb:402
end
end
if (@flush_mode != :interval) && buffer_conf.has_key?('flush_interval')
if buffer_conf.has_key?('flush_mode')
raise Fluent::ConfigError, "'flush_interval' can't be specified when 'flush_mode' is not 'interval' explicitly: '#{@flush_mode}'"
else
log.warn "'flush_interval' is ignored because default 'flush_mode' is not 'interval': '#{@flush_mode}'"
end
end
if @buffer.queued_chunks_limit_size.nil?
@buffer.queued_chunks_limit_size = @buffer_config.flush_thread_count
end
end
if @secondary_config
raise Fluent::ConfigError, "Invalid <secondary> section for non-buffered plugin" unless @buffering
raise Fluent::ConfigError, "<secondary> section cannot have <buffer> section" if @secondary_config.buffer
raise Fluent::ConfigError, "<secondary> section cannot have <secondary> section" if @secondary_config.secondary
if @buffer_config.retry_forever
log.warn "<secondary> with 'retry_forever', only unrecoverable errors are moved to secondary"
end
secondary_type = @secondary_config[:@type]
unless secondary_type
secondary_type = conf['@type'] # primary plugin type
end
secondary_conf = conf.elements(name: 'secondary').first
@secondary = Plugin.new_output(secondary_type)
unless @secondary.respond_to?(:acts_as_secondary)
raise Fluent::ConfigError, "Failed to setup secondary plugin in '#{conf['@type']}'. '#{secondary_type}' plugin in not allowed due to non buffered output"
end
@secondary.acts_as_secondary(self)
@secondary.configure(secondary_conf)
if (@secondary.class.to_s != "Fluent::Plugin::SecondaryFileOutput") &&
(self.class != @secondary.class) &&View on GitHub (pinned to dd45c6e18d)
Solutions
- Delete the `<buffer>` section from inside `<secondary>`
- Leave buffer tuning (flush_interval, retry_*, timekey) on the primary's `<buffer>` only
- Keep only plugin-specific parameters (e.g. `directory` for secondary_file) inside `<secondary>`
Example fix
# before
<secondary>
@type secondary_file
directory /var/log/fluent/backup
<buffer>
flush_interval 1s
</buffer>
</secondary>
# after
<secondary>
@type secondary_file
directory /var/log/fluent/backup
</secondary> Defensive patterns
Strategy: validation
Validate before calling
fluentd --dry-run -c /etc/fluent/fluent.conf
Prevention
- Keep `<secondary>` blocks minimal: @type plus plugin-specific params only
- All buffer/retry tuning lives on the primary's `<buffer>`
- Template your secondary as `<secondary> @type secondary_file directory ... </secondary>`
When it happens
Trigger: `<secondary> @type file <buffer> ... </buffer> </secondary>` — any buffer subsection inside `<secondary>` triggers the `@secondary_config.buffer` check at output.rb:402 during configure.
Common situations: Copy/pasting the primary plugin's full body (including its `<buffer>` tuning) into the `<secondary>` block; assuming the secondary needs matching buffer settings to work.
Understand the failure class
Background: Config validation failed: what "invalid value for {key}" and settings-rejection errors mean across 19 open-source libraries — this error's family across 19 libraries.
Related errors
- secondary plugin '#{self.class}' must support buffering, but
- secondary plugin '#{self.class}' must support buffering, but
- Invalid <secondary> section for non-buffered plugin
- buffer path is not configured. specify 'path' in <buffer>
- This plugin can only be used in the <secondary> section
AI-assisted analysis of fluent/fluentd@dd45c6e18d (2026-08-21).
Data as JSON: /api/errors/249d936316f751a6.
Report an issue: GitHub.