Skip to content

Commit

Permalink
Merge pull request #1712 from nak0f/elastic-compression
Browse files Browse the repository at this point in the history
elasticsearch output compression_level option
  • Loading branch information
OverOrion authored Apr 2, 2024
2 parents 4e4283f + 9b07b28 commit 73901c8
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ spec:
type: object
type: object
type: object
compression_level:
type: string
content_type:
type: string
custom_headers:
Expand Down Expand Up @@ -1569,6 +1571,8 @@ spec:
type: object
type: object
type: object
compression_level:
type: string
content_type:
type: string
custom_headers:
Expand Down Expand Up @@ -7207,6 +7211,8 @@ spec:
type: object
type: object
type: object
compression_level:
type: string
content_type:
type: string
custom_headers:
Expand Down Expand Up @@ -8497,6 +8503,8 @@ spec:
type: object
type: object
type: object
compression_level:
type: string
content_type:
type: string
custom_headers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ spec:
type: object
type: object
type: object
compression_level:
type: string
content_type:
type: string
custom_headers:
Expand Down Expand Up @@ -1569,6 +1571,8 @@ spec:
type: object
type: object
type: object
compression_level:
type: string
content_type:
type: string
custom_headers:
Expand Down Expand Up @@ -6519,6 +6523,8 @@ spec:
type: object
type: object
type: object
compression_level:
type: string
content_type:
type: string
custom_headers:
Expand Down Expand Up @@ -7809,6 +7815,8 @@ spec:
type: object
type: object
type: object
compression_level:
type: string
content_type:
type: string
custom_headers:
Expand Down
8 changes: 8 additions & 0 deletions config/crd/bases/logging.banzaicloud.io_clusteroutputs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ spec:
type: object
type: object
type: object
compression_level:
type: string
content_type:
type: string
custom_headers:
Expand Down Expand Up @@ -1569,6 +1571,8 @@ spec:
type: object
type: object
type: object
compression_level:
type: string
content_type:
type: string
custom_headers:
Expand Down Expand Up @@ -7207,6 +7211,8 @@ spec:
type: object
type: object
type: object
compression_level:
type: string
content_type:
type: string
custom_headers:
Expand Down Expand Up @@ -8497,6 +8503,8 @@ spec:
type: object
type: object
type: object
compression_level:
type: string
content_type:
type: string
custom_headers:
Expand Down
8 changes: 8 additions & 0 deletions config/crd/bases/logging.banzaicloud.io_outputs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ spec:
type: object
type: object
type: object
compression_level:
type: string
content_type:
type: string
custom_headers:
Expand Down Expand Up @@ -1569,6 +1571,8 @@ spec:
type: object
type: object
type: object
compression_level:
type: string
content_type:
type: string
custom_headers:
Expand Down Expand Up @@ -6519,6 +6523,8 @@ spec:
type: object
type: object
type: object
compression_level:
type: string
content_type:
type: string
custom_headers:
Expand Down Expand Up @@ -7809,6 +7815,8 @@ spec:
type: object
type: object
type: object
compression_level:
type: string
content_type:
type: string
custom_headers:
Expand Down
6 changes: 6 additions & 0 deletions docs/configuration/plugins/outputs/elasticsearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ Configure bulk_message request splitting threshold size. Default value is 20MB.
Default: 20MB
### compression_level (string, optional) {#elasticsearch-compression_level}
Option for adding gzip compression of output data. Valid options: default_compression, best_compression, best_speed, no_compression.
Default: no_compression
### content_type (string, optional) {#elasticsearch-content_type}
With content_type application/x-ndjson, elasticsearch plugin adds application/x-ndjson as Content-Profile in payload.
Expand Down
2 changes: 2 additions & 0 deletions pkg/sdk/logging/model/output/elasticsearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ type ElasticsearchOutput struct {
// If set to true, the output uses the [legacy index template format](https://www.elastic.co/guide/en/elasticsearch/reference/7.13/indices-templates-v1.html). Otherwise, it uses the [composable index template](https://www.elastic.co/guide/en/elasticsearch/reference/7.13/index-templates.html) format. (default: true)
// +kubebuilder:validation:Optional
UseLegacyTemplate *bool `json:"use_legacy_template,omitempty"`
// Option for adding gzip compression of output data. Valid options: default_compression, best_compression, best_speed, no_compression. (default: no_compression)
CompressionLevel string `json:"compression_level,omitempty"`
}

func (e *ElasticsearchOutput) ToDirective(secretLoader secret.SecretLoader, id string) (types.Directive, error) {
Expand Down
2 changes: 2 additions & 0 deletions pkg/sdk/logging/model/output/elasticsearch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ buffer:
timekey: 1m
timekey_wait: 30s
timekey_use_utc: true
compression_level: default_compression
`)
expected := `
<match **>
@type elasticsearch
@id test
compression_level default_compression
exception_backup true
fail_on_detecting_es_version_retry_exceed true
fail_on_putting_template_retry_exceed true
Expand Down

0 comments on commit 73901c8

Please sign in to comment.