Skip to content

Commit

Permalink
Log deprecation warn if memory buffer type not defined (#16498)
Browse files Browse the repository at this point in the history
On 8.x series log a deprecation log if the user didn't explicitly specify a selection for pipeline.buffer.type. Before this change the default was silently set to direct, after this change if not explicitly defined, the default is still direct but log a deprecation log.

Co-authored-by: Ry Biesemeyer <[email protected]>
  • Loading branch information
andsel and yaauie authored Oct 15, 2024
1 parent 4677cb2 commit c1374a1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config/logstash.yml
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@
#
# Determine where to allocate memory buffers, for plugins that leverage them.
# Default to direct, optionally can be switched to heap to select Java heap space.
# pipeline.buffer.type: direct
# pipeline.buffer.type: heap
#
# ------------ X-Pack Settings (not applicable for OSS build)--------------
#
Expand Down
2 changes: 1 addition & 1 deletion logstash-core/lib/logstash/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ module Environment
Setting::String.new("keystore.classname", "org.logstash.secret.store.backend.JavaKeyStore"),
Setting::String.new("keystore.file", ::File.join(::File.join(LogStash::Environment::LOGSTASH_HOME, "config"), "logstash.keystore"), false), # will be populated on
Setting::NullableString.new("monitoring.cluster_uuid"),
Setting::String.new("pipeline.buffer.type", "direct", true, ["direct", "heap"])
Setting::String.new("pipeline.buffer.type", nil, false, ["direct", "heap"])
# post_process
].each {|setting| SETTINGS.register(setting) }

Expand Down
12 changes: 10 additions & 2 deletions logstash-core/lib/logstash/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,17 @@ def execute
if setting("config.debug") && !logger.debug?
logger.warn("--config.debug was specified, but log.level was not set to \'debug\'! No config info will be logged.")
end
if setting("pipeline.buffer.type") != nil
configure_pipeline_buffer_type
if setting("pipeline.buffer.type") == nil
deprecation_logger.deprecated(
"'pipeline.buffer.type' setting is not explicitly defined."\
"Before moving to 9.x set it to 'heap' and tune heap size upward, or set it to 'direct' to maintain existing behavior."
)

# set to direct to keep backward ecs_compatibility
buffer_type_setting = @settings.get_setting("pipeline.buffer.type")
buffer_type_setting.set("direct")
end
configure_pipeline_buffer_type

while (msg = LogStash::DeprecationMessage.instance.shift)
deprecation_logger.deprecated msg
Expand Down

0 comments on commit c1374a1

Please sign in to comment.