Skip to content

Commit

Permalink
Add support for idle_connection_timeout to elasticsearch output (#36843)
Browse files Browse the repository at this point in the history
* Add support for idle_connection_timeout to elasticsearch output
  • Loading branch information
leehinman authored Oct 25, 2023
1 parent 5d6c308 commit 55df09f
Show file tree
Hide file tree
Showing 19 changed files with 87 additions and 1 deletion.
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
5 changes: 5 additions & 0 deletions libbeat/_meta/config/output-elasticsearch.reference.yml.tmpl
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

0 comments on commit 55df09f

Please sign in to comment.