Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support performance presets in the Elasticsearch output #37259

Merged
merged 17 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Upgrade golang/x/net to v0.17.0. Updates the publicsuffix table used by the registered_domain processor. {pull}36969[36969]
Setting environmental variable ELASTIC_NETINFO:false in Elastic Agent pod will disable the netinfo.enabled option of add_host_metadata processor
- Upgrade to Go 1.20.11. {pull}37123[37123]
- The Elasticsearch output can now configure performance presets with the `preset` configuration field. {pull}37259[37259]

*Auditbeat*

Expand Down
29 changes: 23 additions & 6 deletions auditbeat/auditbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,25 +200,27 @@ auditbeat.modules:
#timestamp.precision: millisecond

# Internal queue configuration for buffering events to be published.
# Queue settings may be overridden by performance presets in the
# Elasticsearch output. To configure them manually use "preset: custom".
#queue:
# Queue type by name (default 'mem')
# The memory queue will present all available events (up to the outputs
# bulk_max_size) to the output, the moment the output is ready to serve
# another batch of events.
#mem:
# Max number of events the queue can buffer.
#events: 4096
#events: 3200

# Hints the minimum number of events stored in the queue,
# before providing a batch of events to the outputs.
# The default value is set to 2048.
# A value of 0 ensures events are immediately available
# to be sent to the outputs.
#flush.min_events: 2048
#flush.min_events: 1600

# Maximum duration after which events are available to the outputs,
# if the number of events stored in the queue is < `flush.min_events`.
#flush.timeout: 1s
#flush.timeout: 10s

# The disk queue stores incoming events on disk until the output is
# ready for them. This allows a higher event limit than the memory-only
Expand Down Expand Up @@ -450,7 +452,15 @@ output.elasticsearch:
# IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
hosts: ["localhost:9200"]

# Performance presets configure other output fields to recommended values
# based on a performance priority.
# Options are "balanced", "throughput", "scale", "latency" and "custom".
# Default if unspecified: "custom"
preset: balanced

# Set gzip compression level. Set to 0 to disable compression.
# This field may conflict with performance presets. To set it
# manually use "preset: custom".
# The default is 1.
#compression_level: 1

Expand All @@ -471,6 +481,8 @@ output.elasticsearch:
#param2: value2

# Number of workers per Elasticsearch host.
# This field may conflict with performance presets. To set it
# manually use "preset: custom".
#worker: 1

# If set to true and multiple hosts are configured, the output plugin load
Expand Down Expand Up @@ -508,8 +520,10 @@ output.elasticsearch:
#max_retries: 3

# The maximum number of events to bulk in a single Elasticsearch bulk API index request.
# The default is 50.
#bulk_max_size: 50
# This field may conflict with performance presets. To set it
# manually use "preset: custom".
# The default is 1600.
#bulk_max_size: 1600

# The number of seconds to wait before trying to reconnect to Elasticsearch
# after a network error. After waiting backoff.init seconds, the Beat
Expand All @@ -525,7 +539,10 @@ output.elasticsearch:
# The maximum amount of time an idle connection will remain idle
# before closing itself. Zero means use the default of 60s. The
# format is a Go language duration (example 60s is 60 seconds).
# idle_connection_timeout: 60s
# This field may conflict with performance presets. To set it
# manually use "preset: custom".
# The default is 3s.
# idle_connection_timeout: 3s

# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90
Expand Down
4 changes: 4 additions & 0 deletions auditbeat/auditbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ output.elasticsearch:
# Array of hosts to connect to.
hosts: ["localhost:9200"]

# Performance preset - one of "balanced", "throughput", "scale",
# "latency", or "custom".
preset: balanced

# Protocol - either `http` (default) or `https`.
#protocol: "https"

Expand Down
29 changes: 23 additions & 6 deletions filebeat/filebeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1296,25 +1296,27 @@ filebeat.inputs:
#timestamp.precision: millisecond

# Internal queue configuration for buffering events to be published.
# Queue settings may be overridden by performance presets in the
# Elasticsearch output. To configure them manually use "preset: custom".
#queue:
# Queue type by name (default 'mem')
# The memory queue will present all available events (up to the outputs
# bulk_max_size) to the output, the moment the output is ready to serve
# another batch of events.
#mem:
# Max number of events the queue can buffer.
#events: 4096
#events: 3200

# Hints the minimum number of events stored in the queue,
# before providing a batch of events to the outputs.
# The default value is set to 2048.
# A value of 0 ensures events are immediately available
# to be sent to the outputs.
#flush.min_events: 2048
#flush.min_events: 1600

# Maximum duration after which events are available to the outputs,
# if the number of events stored in the queue is < `flush.min_events`.
#flush.timeout: 1s
#flush.timeout: 10s

# The disk queue stores incoming events on disk until the output is
# ready for them. This allows a higher event limit than the memory-only
Expand Down Expand Up @@ -1546,7 +1548,15 @@ output.elasticsearch:
# IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
hosts: ["localhost:9200"]

# Performance presets configure other output fields to recommended values
# based on a performance priority.
# Options are "balanced", "throughput", "scale", "latency" and "custom".
# Default if unspecified: "custom"
preset: balanced

# Set gzip compression level. Set to 0 to disable compression.
# This field may conflict with performance presets. To set it
# manually use "preset: custom".
# The default is 1.
#compression_level: 1

Expand All @@ -1567,6 +1577,8 @@ output.elasticsearch:
#param2: value2

# Number of workers per Elasticsearch host.
# This field may conflict with performance presets. To set it
# manually use "preset: custom".
#worker: 1

# If set to true and multiple hosts are configured, the output plugin load
Expand Down Expand Up @@ -1604,8 +1616,10 @@ output.elasticsearch:
#max_retries: 3

# The maximum number of events to bulk in a single Elasticsearch bulk API index request.
# The default is 50.
#bulk_max_size: 50
# This field may conflict with performance presets. To set it
# manually use "preset: custom".
# The default is 1600.
#bulk_max_size: 1600

# The number of seconds to wait before trying to reconnect to Elasticsearch
# after a network error. After waiting backoff.init seconds, the Beat
Expand All @@ -1621,7 +1635,10 @@ output.elasticsearch:
# The maximum amount of time an idle connection will remain idle
# before closing itself. Zero means use the default of 60s. The
# format is a Go language duration (example 60s is 60 seconds).
# idle_connection_timeout: 60s
# This field may conflict with performance presets. To set it
# manually use "preset: custom".
# The default is 3s.
# idle_connection_timeout: 3s

# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90
Expand Down
4 changes: 4 additions & 0 deletions filebeat/filebeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ output.elasticsearch:
# Array of hosts to connect to.
hosts: ["localhost:9200"]

# Performance preset - one of "balanced", "throughput", "scale",
# "latency", or "custom".
preset: balanced

# Protocol - either `http` (default) or `https`.
#protocol: "https"

Expand Down
29 changes: 23 additions & 6 deletions heartbeat/heartbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -292,25 +292,27 @@ heartbeat.jobs:
#timestamp.precision: millisecond

# Internal queue configuration for buffering events to be published.
# Queue settings may be overridden by performance presets in the
# Elasticsearch output. To configure them manually use "preset: custom".
#queue:
# Queue type by name (default 'mem')
# The memory queue will present all available events (up to the outputs
# bulk_max_size) to the output, the moment the output is ready to serve
# another batch of events.
#mem:
# Max number of events the queue can buffer.
#events: 4096
#events: 3200

# Hints the minimum number of events stored in the queue,
# before providing a batch of events to the outputs.
# The default value is set to 2048.
# A value of 0 ensures events are immediately available
# to be sent to the outputs.
#flush.min_events: 2048
#flush.min_events: 1600

# Maximum duration after which events are available to the outputs,
# if the number of events stored in the queue is < `flush.min_events`.
#flush.timeout: 1s
#flush.timeout: 10s

# The disk queue stores incoming events on disk until the output is
# ready for them. This allows a higher event limit than the memory-only
Expand Down Expand Up @@ -542,7 +544,15 @@ output.elasticsearch:
# IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
hosts: ["localhost:9200"]

# Performance presets configure other output fields to recommended values
# based on a performance priority.
# Options are "balanced", "throughput", "scale", "latency" and "custom".
# Default if unspecified: "custom"
preset: balanced

# Set gzip compression level. Set to 0 to disable compression.
# This field may conflict with performance presets. To set it
# manually use "preset: custom".
# The default is 1.
#compression_level: 1

Expand All @@ -563,6 +573,8 @@ output.elasticsearch:
#param2: value2

# Number of workers per Elasticsearch host.
# This field may conflict with performance presets. To set it
# manually use "preset: custom".
#worker: 1

# If set to true and multiple hosts are configured, the output plugin load
Expand Down Expand Up @@ -600,8 +612,10 @@ output.elasticsearch:
#max_retries: 3

# The maximum number of events to bulk in a single Elasticsearch bulk API index request.
# The default is 50.
#bulk_max_size: 50
# This field may conflict with performance presets. To set it
# manually use "preset: custom".
# The default is 1600.
#bulk_max_size: 1600

# The number of seconds to wait before trying to reconnect to Elasticsearch
# after a network error. After waiting backoff.init seconds, the Beat
Expand All @@ -617,7 +631,10 @@ output.elasticsearch:
# The maximum amount of time an idle connection will remain idle
# before closing itself. Zero means use the default of 60s. The
# format is a Go language duration (example 60s is 60 seconds).
# idle_connection_timeout: 60s
# This field may conflict with performance presets. To set it
# manually use "preset: custom".
# The default is 3s.
# idle_connection_timeout: 3s

# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90
Expand Down
4 changes: 4 additions & 0 deletions heartbeat/heartbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ output.elasticsearch:
# Array of hosts to connect to.
hosts: ["localhost:9200"]

# Performance preset - one of "balanced", "throughput", "scale",
# "latency", or "custom".
preset: balanced

# Protocol - either `http` (default) or `https`.
#protocol: "https"

Expand Down
8 changes: 5 additions & 3 deletions libbeat/_meta/config/general.reference.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,27 @@
#timestamp.precision: millisecond

# Internal queue configuration for buffering events to be published.
# Queue settings may be overridden by performance presets in the
# Elasticsearch output. To configure them manually use "preset: custom".
#queue:
# Queue type by name (default 'mem')
# The memory queue will present all available events (up to the outputs
# bulk_max_size) to the output, the moment the output is ready to serve
# another batch of events.
#mem:
# Max number of events the queue can buffer.
#events: 4096
#events: 3200

# Hints the minimum number of events stored in the queue,
# before providing a batch of events to the outputs.
# The default value is set to 2048.
# A value of 0 ensures events are immediately available
# to be sent to the outputs.
#flush.min_events: 2048
#flush.min_events: 1600

# Maximum duration after which events are available to the outputs,
# if the number of events stored in the queue is < `flush.min_events`.
#flush.timeout: 1s
#flush.timeout: 10s

# The disk queue stores incoming events on disk until the output is
# ready for them. This allows a higher event limit than the memory-only
Expand Down
21 changes: 18 additions & 3 deletions libbeat/_meta/config/output-elasticsearch.reference.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ output.elasticsearch:
# IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
hosts: ["localhost:9200"]

# Performance presets configure other output fields to recommended values
# based on a performance priority.
# Options are "balanced", "throughput", "scale", "latency" and "custom".
# Default if unspecified: "custom"
preset: balanced

# Set gzip compression level. Set to 0 to disable compression.
# This field may conflict with performance presets. To set it
# manually use "preset: custom".
# The default is 1.
#compression_level: 1

Expand All @@ -30,6 +38,8 @@ output.elasticsearch:
#param2: value2

# Number of workers per Elasticsearch host.
# This field may conflict with performance presets. To set it
# manually use "preset: custom".
#worker: 1

# If set to true and multiple hosts are configured, the output plugin load
Expand Down Expand Up @@ -67,8 +77,10 @@ output.elasticsearch:
#max_retries: 3

# The maximum number of events to bulk in a single Elasticsearch bulk API index request.
# The default is 50.
#bulk_max_size: 50
# This field may conflict with performance presets. To set it
# manually use "preset: custom".
# The default is 1600.
#bulk_max_size: 1600

# The number of seconds to wait before trying to reconnect to Elasticsearch
# after a network error. After waiting backoff.init seconds, the Beat
Expand All @@ -84,7 +96,10 @@ output.elasticsearch:
# The maximum amount of time an idle connection will remain idle
# before closing itself. Zero means use the default of 60s. The
# format is a Go language duration (example 60s is 60 seconds).
# idle_connection_timeout: 60s
# This field may conflict with performance presets. To set it
# manually use "preset: custom".
# The default is 3s.
# idle_connection_timeout: 3s

# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90
Expand Down
4 changes: 4 additions & 0 deletions libbeat/_meta/config/output-elasticsearch.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ output.elasticsearch:
# Array of hosts to connect to.
hosts: ["localhost:9200"]

# Performance preset - one of "balanced", "throughput", "scale",
# "latency", or "custom".
preset: balanced

# Protocol - either `http` (default) or `https`.
#protocol: "https"

Expand Down
2 changes: 1 addition & 1 deletion libbeat/outputs/elasticsearch/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ type elasticsearchConfig struct {
Backoff Backoff `config:"backoff"`
NonIndexablePolicy *config.Namespace `config:"non_indexable_policy"`
AllowOlderVersion bool `config:"allow_older_versions"`
Queue config.Namespace `config:"queue"`

Transport httpcommon.HTTPTransportSettings `config:",inline"`
Queue config.Namespace `config:"queue"`
}

type Backoff struct {
Expand Down