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

Default allow_older_versions to true #36884

Merged
merged 8 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from 7 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
5 changes: 2 additions & 3 deletions auditbeat/auditbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -525,9 +525,8 @@ output.elasticsearch:
# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

# auditbeat expects Elasticsearch to be the same version or newer than the Beat.
# Lift the version restriction by setting allow_older_versions to true.
#allow_older_versions: false
# Prevents auditbeat from connecting to older Elasticsearch versions when set to `false`
#allow_older_versions: true

# Use SSL settings for HTTPS.
#ssl.enabled: true
Expand Down
5 changes: 2 additions & 3 deletions filebeat/filebeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1621,9 +1621,8 @@ output.elasticsearch:
# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

# filebeat expects Elasticsearch to be the same version or newer than the Beat.
# Lift the version restriction by setting allow_older_versions to true.
#allow_older_versions: false
# Prevents filebeat from connecting to older Elasticsearch versions when set to `false`
#allow_older_versions: true

# Use SSL settings for HTTPS.
#ssl.enabled: true
Expand Down
5 changes: 2 additions & 3 deletions heartbeat/heartbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -617,9 +617,8 @@ output.elasticsearch:
# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

# heartbeat expects Elasticsearch to be the same version or newer than the Beat.
# Lift the version restriction by setting allow_older_versions to true.
#allow_older_versions: false
# Prevents heartbeat from connecting to older Elasticsearch versions when set to `false`
#allow_older_versions: true

# Use SSL settings for HTTPS.
#ssl.enabled: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,8 @@ output.elasticsearch:
# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

# {{.BeatName}} expects Elasticsearch to be the same version or newer than the Beat.
# Lift the version restriction by setting allow_older_versions to true.
#allow_older_versions: false
# Prevents {{.BeatName}} from connecting to older Elasticsearch versions when set to `false`
#allow_older_versions: true
cmacknz marked this conversation as resolved.
Show resolved Hide resolved

{{include "ssl.reference.yml.tmpl" . | indent 2 }}

Expand Down
10 changes: 6 additions & 4 deletions libbeat/cmd/instance/beat.go
Original file line number Diff line number Diff line change
Expand Up @@ -1028,16 +1028,18 @@ func (b *Beat) loadDashboards(ctx context.Context, force bool) error {
func (b *Beat) registerESVersionCheckCallback() error {
_, err := elasticsearch.RegisterGlobalCallback(func(conn *eslegclient.Connection) error {
if !isElasticsearchOutput(b.Config.Output.Name()) {
return errors.New("Elasticsearch output is not configured")
return errors.New("elasticsearch output is not configured")
}
if b.isConnectionToOlderVersionAllowed() {
// if we allow older versions, return early and don't check versions
// versions don't matter on serverless, so always bypass
if b.isConnectionToOlderVersionAllowed() || conn.IsServerless() {
cmacknz marked this conversation as resolved.
Show resolved Hide resolved
return nil
}

esVersion := conn.GetVersion()
beatVersion, err := libversion.New(b.Info.Version)
if err != nil {
return err
return fmt.Errorf("error fetching version from elasticsearch: %w", err)
}
if esVersion.LessThanMajorMinor(beatVersion) {
return fmt.Errorf("%w ES=%s, Beat=%s", elasticsearch.ErrTooOld, esVersion.String(), b.Info.Version)
Expand All @@ -1051,7 +1053,7 @@ func (b *Beat) registerESVersionCheckCallback() error {
func (b *Beat) isConnectionToOlderVersionAllowed() bool {
config := struct {
AllowOlder bool `config:"allow_older_versions"`
}{false}
}{true}

_ = b.Config.Output.Config().Unpack(&config)

Expand Down
6 changes: 3 additions & 3 deletions libbeat/cmd/instance/beat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func TestReloader(t *testing.T) {
elasticsearch:
hosts: ["https://127.0.0.1:9200"]
username: "elastic"
allow_older_versions: true
allow_older_versions: false
`
c, err := config.NewConfigWithYAML([]byte(cfg), cfg)
require.NoError(t, err)
Expand All @@ -248,13 +248,13 @@ elasticsearch:
reloader := b.makeOutputReloader(m)

require.False(t, b.Config.Output.IsSet(), "the output should not be set yet")
require.False(t, b.isConnectionToOlderVersionAllowed(), "the flag should not be present in the empty configuration")
require.True(t, b.isConnectionToOlderVersionAllowed(), "allow_older_versions flag should be true from 8.11")
err = reloader.Reload(update)
require.NoError(t, err)
require.True(t, b.Config.Output.IsSet(), "now the output should be set")
require.Equal(t, outCfg, b.Config.Output.Config())
require.Same(t, c, m.cfg.Config)
require.True(t, b.isConnectionToOlderVersionAllowed(), "the flag should be present")
require.False(t, b.isConnectionToOlderVersionAllowed(), "allow_older_versions flag should now be set to false")
})
}

Expand Down
5 changes: 2 additions & 3 deletions metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1360,9 +1360,8 @@ output.elasticsearch:
# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

# metricbeat expects Elasticsearch to be the same version or newer than the Beat.
# Lift the version restriction by setting allow_older_versions to true.
#allow_older_versions: false
# Prevents metricbeat from connecting to older Elasticsearch versions when set to `false`
#allow_older_versions: true

# Use SSL settings for HTTPS.
#ssl.enabled: true
Expand Down
5 changes: 2 additions & 3 deletions packetbeat/packetbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -991,9 +991,8 @@ output.elasticsearch:
# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

# packetbeat expects Elasticsearch to be the same version or newer than the Beat.
# Lift the version restriction by setting allow_older_versions to true.
#allow_older_versions: false
# Prevents packetbeat from connecting to older Elasticsearch versions when set to `false`
#allow_older_versions: true

# Use SSL settings for HTTPS.
#ssl.enabled: true
Expand Down
5 changes: 2 additions & 3 deletions winlogbeat/winlogbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,8 @@ output.elasticsearch:
# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

# winlogbeat expects Elasticsearch to be the same version or newer than the Beat.
# Lift the version restriction by setting allow_older_versions to true.
#allow_older_versions: false
# Prevents winlogbeat from connecting to older Elasticsearch versions when set to `false`
#allow_older_versions: true

# Use SSL settings for HTTPS.
#ssl.enabled: true
Expand Down
5 changes: 2 additions & 3 deletions x-pack/auditbeat/auditbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -581,9 +581,8 @@ output.elasticsearch:
# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

# auditbeat expects Elasticsearch to be the same version or newer than the Beat.
# Lift the version restriction by setting allow_older_versions to true.
#allow_older_versions: false
# Prevents auditbeat from connecting to older Elasticsearch versions when set to `false`
#allow_older_versions: true

# Use SSL settings for HTTPS.
#ssl.enabled: true
Expand Down
5 changes: 2 additions & 3 deletions x-pack/filebeat/filebeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3991,9 +3991,8 @@ output.elasticsearch:
# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

# filebeat expects Elasticsearch to be the same version or newer than the Beat.
# Lift the version restriction by setting allow_older_versions to true.
#allow_older_versions: false
# Prevents filebeat from connecting to older Elasticsearch versions when set to `false`
#allow_older_versions: true

# Use SSL settings for HTTPS.
#ssl.enabled: true
Expand Down
5 changes: 2 additions & 3 deletions x-pack/functionbeat/functionbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -649,9 +649,8 @@ output.elasticsearch:
# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

# functionbeat expects Elasticsearch to be the same version or newer than the Beat.
# Lift the version restriction by setting allow_older_versions to true.
#allow_older_versions: false
# Prevents functionbeat from connecting to older Elasticsearch versions when set to `false`
#allow_older_versions: true

# Use SSL settings for HTTPS.
#ssl.enabled: true
Expand Down
5 changes: 2 additions & 3 deletions x-pack/heartbeat/heartbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -617,9 +617,8 @@ output.elasticsearch:
# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

# heartbeat expects Elasticsearch to be the same version or newer than the Beat.
# Lift the version restriction by setting allow_older_versions to true.
#allow_older_versions: false
# Prevents heartbeat from connecting to older Elasticsearch versions when set to `false`
#allow_older_versions: true

# Use SSL settings for HTTPS.
#ssl.enabled: true
Expand Down
5 changes: 2 additions & 3 deletions x-pack/metricbeat/metricbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1921,9 +1921,8 @@ output.elasticsearch:
# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

# metricbeat expects Elasticsearch to be the same version or newer than the Beat.
# Lift the version restriction by setting allow_older_versions to true.
#allow_older_versions: false
# Prevents metricbeat from connecting to older Elasticsearch versions when set to `false`
#allow_older_versions: true

# Use SSL settings for HTTPS.
#ssl.enabled: true
Expand Down
5 changes: 2 additions & 3 deletions x-pack/osquerybeat/osquerybeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,8 @@ output.elasticsearch:
# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

# osquerybeat expects Elasticsearch to be the same version or newer than the Beat.
# Lift the version restriction by setting allow_older_versions to true.
#allow_older_versions: false
# Prevents osquerybeat from connecting to older Elasticsearch versions when set to `false`
#allow_older_versions: true

# Use SSL settings for HTTPS.
#ssl.enabled: true
Expand Down
5 changes: 2 additions & 3 deletions x-pack/packetbeat/packetbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -991,9 +991,8 @@ output.elasticsearch:
# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

# packetbeat expects Elasticsearch to be the same version or newer than the Beat.
# Lift the version restriction by setting allow_older_versions to true.
#allow_older_versions: false
# Prevents packetbeat from connecting to older Elasticsearch versions when set to `false`
#allow_older_versions: true

# Use SSL settings for HTTPS.
#ssl.enabled: true
Expand Down
5 changes: 2 additions & 3 deletions x-pack/winlogbeat/winlogbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,8 @@ output.elasticsearch:
# Configure HTTP request timeout before failing a request to Elasticsearch.
#timeout: 90

# winlogbeat expects Elasticsearch to be the same version or newer than the Beat.
# Lift the version restriction by setting allow_older_versions to true.
#allow_older_versions: false
# Prevents winlogbeat from connecting to older Elasticsearch versions when set to `false`
#allow_older_versions: true

# Use SSL settings for HTTPS.
#ssl.enabled: true
Expand Down
Loading