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

Add support for idle_connection_timeout to elasticsearch output #36843

Merged
merged 4 commits into from
Oct 25, 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
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ is collected by it.
- allow `queue` configuration settings to be set under the output. {issue}35615[35615] {pull}36788[36788]
- Beats will now connect to older Elasticsearch instances by default {pull}36884[36884]
- Raise up logging level to warning when attempting to configure beats with unknown fields from autodiscovered events/environments
- elasticsearch output now supports `idle_connection_timeout`. {issue}35616[35615] {pull}36843[36843]

*Auditbeat*

Expand Down
5 changes: 5 additions & 0 deletions auditbeat/auditbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,11 @@ output.elasticsearch:
# Elasticsearch after a network error. The default is 60s.
#backoff.max: 60s

# 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

# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

Expand Down
5 changes: 5 additions & 0 deletions filebeat/filebeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1618,6 +1618,11 @@ output.elasticsearch:
# Elasticsearch after a network error. The default is 60s.
#backoff.max: 60s

# 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

# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

Expand Down
5 changes: 5 additions & 0 deletions heartbeat/heartbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,11 @@ output.elasticsearch:
# Elasticsearch after a network error. The default is 60s.
#backoff.max: 60s

# 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

# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ output.elasticsearch:
# Elasticsearch after a network error. The default is 60s.
#backoff.max: 60s

# 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

# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

Expand Down
1 change: 1 addition & 0 deletions libbeat/outputs/elasticsearch/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func NewClient(
CompressionLevel: s.CompressionLevel,
EscapeHTML: s.EscapeHTML,
Transport: s.Transport,
IdleConnTimeout: s.IdleConnTimeout,
})
if err != nil {
return nil, err
Expand Down
6 changes: 6 additions & 0 deletions libbeat/outputs/elasticsearch/docs/elasticsearch.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,12 @@ default is `1s`.
The maximum number of seconds to wait before attempting to connect to
Elasticsearch after a network error. The default is `60s`.

===== `idle_connection_timeout`

The maximum amount of time an idle connection will remain idle before closing itself.
Zero means no limit. The format is a Go language duration (example 60s is 60 seconds).
The default is 0.

===== `timeout`

The http request timeout in seconds for the Elasticsearch request. The default is 90.
Expand Down
5 changes: 4 additions & 1 deletion libbeat/outputs/elasticsearch/elasticsearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ func makeES(
) (outputs.Group, error) {
log := logp.NewLogger(logSelector)
if !cfg.HasField("bulk_max_size") {
_ = cfg.SetInt("bulk_max_size", -1, defaultBulkSize)
if err := cfg.SetInt("bulk_max_size", -1, defaultBulkSize); err != nil {
return outputs.Fail(err)
}
}

index, pipeline, err := buildSelectors(im, beat, cfg)
Expand Down Expand Up @@ -105,6 +107,7 @@ func makeES(
Observer: observer,
EscapeHTML: esConfig.EscapeHTML,
Transport: esConfig.Transport,
IdleConnTimeout: esConfig.Transport.IdleConnTimeout,
},
Index: index,
Pipeline: pipeline,
Expand Down
5 changes: 5 additions & 0 deletions metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1357,6 +1357,11 @@ output.elasticsearch:
# Elasticsearch after a network error. The default is 60s.
#backoff.max: 60s

# 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

# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

Expand Down
5 changes: 5 additions & 0 deletions packetbeat/packetbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,11 @@ output.elasticsearch:
# Elasticsearch after a network error. The default is 60s.
#backoff.max: 60s

# 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

# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

Expand Down
5 changes: 5 additions & 0 deletions winlogbeat/winlogbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,11 @@ output.elasticsearch:
# Elasticsearch after a network error. The default is 60s.
#backoff.max: 60s

# 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

# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

Expand Down
5 changes: 5 additions & 0 deletions x-pack/auditbeat/auditbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,11 @@ output.elasticsearch:
# Elasticsearch after a network error. The default is 60s.
#backoff.max: 60s

# 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

# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

Expand Down
5 changes: 5 additions & 0 deletions x-pack/filebeat/filebeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3988,6 +3988,11 @@ output.elasticsearch:
# Elasticsearch after a network error. The default is 60s.
#backoff.max: 60s

# 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

# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

Expand Down
5 changes: 5 additions & 0 deletions x-pack/functionbeat/functionbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,11 @@ output.elasticsearch:
# Elasticsearch after a network error. The default is 60s.
#backoff.max: 60s

# 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

# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

Expand Down
5 changes: 5 additions & 0 deletions x-pack/heartbeat/heartbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,11 @@ output.elasticsearch:
# Elasticsearch after a network error. The default is 60s.
#backoff.max: 60s

# 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

# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

Expand Down
5 changes: 5 additions & 0 deletions x-pack/metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1918,6 +1918,11 @@ output.elasticsearch:
# Elasticsearch after a network error. The default is 60s.
#backoff.max: 60s

# 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

# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

Expand Down
5 changes: 5 additions & 0 deletions x-pack/osquerybeat/osquerybeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,11 @@ output.elasticsearch:
# Elasticsearch after a network error. The default is 60s.
#backoff.max: 60s

# 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

# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

Expand Down
5 changes: 5 additions & 0 deletions x-pack/packetbeat/packetbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,11 @@ output.elasticsearch:
# Elasticsearch after a network error. The default is 60s.
#backoff.max: 60s

# 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

# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

Expand Down
5 changes: 5 additions & 0 deletions x-pack/winlogbeat/winlogbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,11 @@ output.elasticsearch:
# Elasticsearch after a network error. The default is 60s.
#backoff.max: 60s

# 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

# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

Expand Down
Loading