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

[7.17](backport #36681) Enable compression by default for Elasticsearch outputs #36708

Merged
merged 2 commits into from
Oct 2, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
==== Breaking changes

*Affecting all Beats*
- The Elasticsearch output now enables compression by default. This decreases network data usage by an average of 70-80%, in exchange for 20-25% increased CPU use and ~10% increased ingestion time. The previous default can be restored by setting the flag `compression_level: 0` under `output.elasticsearch`. {pull}36681[36681]


*Auditbeat*

Expand Down
5 changes: 3 additions & 2 deletions auditbeat/auditbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,9 @@ output.elasticsearch:
# IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
hosts: ["localhost:9200"]

# Set gzip compression level.
#compression_level: 0
# Set gzip compression level. Set to 0 to disable compression.
# The default is 1.
#compression_level: 1

# Configure escaping HTML symbols in strings.
#escape_html: false
Expand Down
5 changes: 3 additions & 2 deletions filebeat/filebeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1477,8 +1477,9 @@ output.elasticsearch:
# IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
hosts: ["localhost:9200"]

# Set gzip compression level.
#compression_level: 0
# Set gzip compression level. Set to 0 to disable compression.
# The default is 1.
#compression_level: 1

# Configure escaping HTML symbols in strings.
#escape_html: false
Expand Down
5 changes: 3 additions & 2 deletions heartbeat/heartbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,9 @@ output.elasticsearch:
# IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
hosts: ["localhost:9200"]

# Set gzip compression level.
#compression_level: 0
# Set gzip compression level. Set to 0 to disable compression.
# The default is 1.
#compression_level: 1

# Configure escaping HTML symbols in strings.
#escape_html: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ output.elasticsearch:
# IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
hosts: ["localhost:9200"]

# Set gzip compression level.
#compression_level: 0
# Set gzip compression level. Set to 0 to disable compression.
# The default is 1.
#compression_level: 1

# Configure escaping HTML symbols in strings.
#escape_html: false
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 @@ -65,7 +65,7 @@ var (
Password: "",
APIKey: "",
MaxRetries: 3,
CompressionLevel: 0,
CompressionLevel: 1,
EscapeHTML: false,
Kerberos: nil,
LoadBalance: true,
Expand Down
22 changes: 22 additions & 0 deletions libbeat/outputs/elasticsearch/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,28 @@ non_indexable_policy.dead_letter_index:
}
}

func TestCompressionIsOnByDefault(t *testing.T) {
config := ""
c := common.MustNewConfigFrom(config)
elasticsearchOutputConfig, err := readConfig(c)
if err != nil {
t.Fatalf("Can't create test configuration from valid input")
}
assert.Equal(t, 1, elasticsearchOutputConfig.CompressionLevel, "Default compression level should be 1")
}

func TestExplicitCompressionLevelOverridesDefault(t *testing.T) {
config := `
compression_level: 0
`
c := common.MustNewConfigFrom(config)
elasticsearchOutputConfig, err := readConfig(c)
if err != nil {
t.Fatalf("Can't create test configuration from valid input")
}
assert.Equal(t, 0, elasticsearchOutputConfig.CompressionLevel, "Explicit compression level should override defaults")
}

func readConfig(cfg *common.Config) (*elasticsearchConfig, error) {
c := defaultConfig
if err := cfg.Unpack(&c); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ The compression level must be in the range of `1` (best speed) to `9` (best comp

Increasing the compression level will reduce the network usage but will increase the cpu usage.

The default value is `0`.
The default value is `1`.

===== `escape_html`

Expand Down
5 changes: 3 additions & 2 deletions metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1265,8 +1265,9 @@ output.elasticsearch:
# IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
hosts: ["localhost:9200"]

# Set gzip compression level.
#compression_level: 0
# Set gzip compression level. Set to 0 to disable compression.
# The default is 1.
#compression_level: 1

# Configure escaping HTML symbols in strings.
#escape_html: false
Expand Down
5 changes: 3 additions & 2 deletions packetbeat/packetbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -947,8 +947,9 @@ output.elasticsearch:
# IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
hosts: ["localhost:9200"]

# Set gzip compression level.
#compression_level: 0
# Set gzip compression level. Set to 0 to disable compression.
# The default is 1.
#compression_level: 1

# Configure escaping HTML symbols in strings.
#escape_html: false
Expand Down
5 changes: 3 additions & 2 deletions winlogbeat/winlogbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,9 @@ output.elasticsearch:
# IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
hosts: ["localhost:9200"]

# Set gzip compression level.
#compression_level: 0
# Set gzip compression level. Set to 0 to disable compression.
# The default is 1.
#compression_level: 1

# Configure escaping HTML symbols in strings.
#escape_html: false
Expand Down
5 changes: 3 additions & 2 deletions x-pack/auditbeat/auditbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,9 @@ output.elasticsearch:
# IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
hosts: ["localhost:9200"]

# Set gzip compression level.
#compression_level: 0
# Set gzip compression level. Set to 0 to disable compression.
# The default is 1.
#compression_level: 1

# Configure escaping HTML symbols in strings.
#escape_html: false
Expand Down
5 changes: 3 additions & 2 deletions x-pack/filebeat/filebeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3738,8 +3738,9 @@ output.elasticsearch:
# IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
hosts: ["localhost:9200"]

# Set gzip compression level.
#compression_level: 0
# Set gzip compression level. Set to 0 to disable compression.
# The default is 1.
#compression_level: 1

# Configure escaping HTML symbols in strings.
#escape_html: false
Expand Down
5 changes: 3 additions & 2 deletions x-pack/functionbeat/functionbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -630,8 +630,9 @@ output.elasticsearch:
# IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
hosts: ["localhost:9200"]

# Set gzip compression level.
#compression_level: 0
# Set gzip compression level. Set to 0 to disable compression.
# The default is 1.
#compression_level: 1

# Configure escaping HTML symbols in strings.
#escape_html: false
Expand Down
5 changes: 3 additions & 2 deletions x-pack/heartbeat/heartbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,9 @@ output.elasticsearch:
# IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
hosts: ["localhost:9200"]

# Set gzip compression level.
#compression_level: 0
# Set gzip compression level. Set to 0 to disable compression.
# The default is 1.
#compression_level: 1

# Configure escaping HTML symbols in strings.
#escape_html: false
Expand Down
5 changes: 3 additions & 2 deletions x-pack/metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1796,8 +1796,9 @@ output.elasticsearch:
# IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
hosts: ["localhost:9200"]

# Set gzip compression level.
#compression_level: 0
# Set gzip compression level. Set to 0 to disable compression.
# The default is 1.
#compression_level: 1

# Configure escaping HTML symbols in strings.
#escape_html: false
Expand Down
5 changes: 3 additions & 2 deletions x-pack/osquerybeat/osquerybeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,9 @@ output.elasticsearch:
# IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
hosts: ["localhost:9200"]

# Set gzip compression level.
#compression_level: 0
# Set gzip compression level. Set to 0 to disable compression.
# The default is 1.
#compression_level: 1

# Configure escaping HTML symbols in strings.
#escape_html: false
Expand Down
5 changes: 3 additions & 2 deletions x-pack/packetbeat/packetbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -947,8 +947,9 @@ output.elasticsearch:
# IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
hosts: ["localhost:9200"]

# Set gzip compression level.
#compression_level: 0
# Set gzip compression level. Set to 0 to disable compression.
# The default is 1.
#compression_level: 1

# Configure escaping HTML symbols in strings.
#escape_html: false
Expand Down
5 changes: 3 additions & 2 deletions x-pack/winlogbeat/winlogbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,9 @@ output.elasticsearch:
# IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
hosts: ["localhost:9200"]

# Set gzip compression level.
#compression_level: 0
# Set gzip compression level. Set to 0 to disable compression.
# The default is 1.
#compression_level: 1

# Configure escaping HTML symbols in strings.
#escape_html: false
Expand Down
Loading