logstash-output-elasticsearch 11.2.1-java → 11.3.1-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/lib/logstash/outputs/elasticsearch/data_stream_support.rb +42 -8
- data/lib/logstash/outputs/elasticsearch/templates/ecs-v1/elasticsearch-6x.json +925 -180
- data/lib/logstash/outputs/elasticsearch/templates/ecs-v1/elasticsearch-7x.json +926 -184
- data/lib/logstash/outputs/elasticsearch/templates/ecs-v1/elasticsearch-8x.json +3695 -0
- data/lib/logstash/outputs/elasticsearch/templates/ecs-v8/elasticsearch-7x.json +5777 -0
- data/lib/logstash/outputs/elasticsearch/templates/ecs-v8/elasticsearch-8x.json +5782 -0
- data/lib/logstash/outputs/elasticsearch.rb +11 -2
- data/logstash-output-elasticsearch.gemspec +2 -1
- data/spec/integration/outputs/data_stream_spec.rb +7 -0
- data/spec/integration/outputs/templates_spec.rb +100 -65
- data/spec/unit/outputs/elasticsearch/data_stream_support_spec.rb +52 -4
- data/spec/unit/outputs/elasticsearch/template_manager_spec.rb +6 -0
- data/spec/unit/outputs/elasticsearch_spec.rb +22 -1
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dccee6612b454d47b0596a9feb04db71f51f368a34906f559b8f7a8df7cf166e
|
4
|
+
data.tar.gz: 27d8ab736dd7c3ffa46d1229ad70afd5e8b23813ee09aa3e9d4ec05b4f263a76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7ab3e32387faf0cc2680fc1446e9a330314d2ead466487fd6f63a27ab2757cac8c2d90cb41bb0eba422986b22821d0e0c813617ba153225058b1e1d09765598
|
7
|
+
data.tar.gz: df0a5b6cbcbdc592e1c18906f6a54a97d309afbbd1c36529f812501df31f78c7e4c2ba2fb8a3eab72e9fd53dfbca8388b710dc772a20ba9084c59ce1f5aa43fc
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
## 11.3.1
|
2
|
+
- ECS-related fixes [#1046](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1046)
|
3
|
+
- Data Streams requirement on ECS is properly enforced when running on Logstash 8, and warned about when running on Logstash 7.
|
4
|
+
- ECS Compatibility v8 can now be selected
|
5
|
+
|
6
|
+
## 11.3.0
|
7
|
+
- Adds ECS templates [#1048](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1048)
|
8
|
+
- Adds templates for ECS v1 for Elasticsearch 8.x
|
9
|
+
- Adds templates for BETA preview of ECS v8 for both Elasticsearch 7.x and 8.x
|
10
|
+
|
11
|
+
## 11.2.3
|
12
|
+
- Downgrade ECS templates, pinning to v1.10.0 of upstream; fixes an issue where ECS templates cannot be installed in Elasticsearch 6.x or 7.1-7.2, since the generated templates include fields of `type: flattened` that was introduced in Elasticsearch 7.3
|
13
|
+
|
14
|
+
## 11.2.2
|
15
|
+
- Update ECS templates from upstream; `ecs_compatiblity => v1` now resolves to templates for ECS v1.12.1 [#1027](https://github.com/logstash-plugins/logstash-output-elasticsearch/issues/1027)
|
16
|
+
|
1
17
|
## 11.2.1
|
2
18
|
- Fix referencing Gem classes from global lexical scope [#1044](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1044)
|
3
19
|
|
@@ -2,6 +2,15 @@ module LogStash module Outputs class ElasticSearch
|
|
2
2
|
# DS specific behavior/configuration.
|
3
3
|
module DataStreamSupport
|
4
4
|
|
5
|
+
# @api private
|
6
|
+
ENABLING_ECS_GUIDANCE = <<~END.tr("\n", " ")
|
7
|
+
Elasticsearch data streams require that events adhere to the Elastic Common Schema.
|
8
|
+
While `ecs_compatibility` can be set for this individual Elasticsearch output plugin, doing so will not fix schema conflicts caused by upstream plugins in your pipeline.
|
9
|
+
To avoid mapping conflicts, you will need to use ECS-compatible field names and datatypes throughout your pipeline.
|
10
|
+
Many plugins support an `ecs_compatibility` mode, and the `pipeline.ecs_compatibility` setting can be used to opt-in for all plugins in a pipeline.
|
11
|
+
END
|
12
|
+
private_constant :ENABLING_ECS_GUIDANCE
|
13
|
+
|
5
14
|
def self.included(base)
|
6
15
|
# Defines whether data will be indexed into an Elasticsearch data stream,
|
7
16
|
# `data_stream_*` settings will only be used if this setting is enabled!
|
@@ -36,6 +45,8 @@ module LogStash module Outputs class ElasticSearch
|
|
36
45
|
"#{type}-#{dataset}-#{namespace}"
|
37
46
|
end
|
38
47
|
|
48
|
+
DATA_STREAMS_REQUIRES_ECS_LS_VERSION = '8.0.0'
|
49
|
+
|
39
50
|
# @param params the user configuration for the ES output
|
40
51
|
# @note LS initialized configuration (with filled defaults) won't detect as data-stream
|
41
52
|
# compatible, only explicit (`original_params`) config should be tested.
|
@@ -56,14 +67,26 @@ module LogStash module Outputs class ElasticSearch
|
|
56
67
|
@logger.error "Invalid data stream configuration, following parameters are not supported:", invalid_data_stream_params
|
57
68
|
raise LogStash::ConfigurationError, "Invalid data stream configuration: #{invalid_data_stream_params.keys}"
|
58
69
|
end
|
70
|
+
if ecs_compatibility == :disabled
|
71
|
+
if ::Gem::Version.create(LOGSTASH_VERSION) < ::Gem::Version.create(DATA_STREAMS_REQUIRES_ECS_LS_VERSION)
|
72
|
+
@deprecation_logger.deprecated "In a future release of Logstash, the Elasticsearch output plugin's `data_stream => true` will require the plugin to be run in ECS compatibility mode. " + ENABLING_ECS_GUIDANCE
|
73
|
+
else
|
74
|
+
@logger.error "Invalid data stream configuration; `ecs_compatibility` must not be `disabled`. " + ENABLING_ECS_GUIDANCE
|
75
|
+
raise LogStash::ConfigurationError, "Invalid data stream configuration: `ecs_compatibility => disabled`"
|
76
|
+
end
|
77
|
+
end
|
59
78
|
return true
|
60
79
|
else
|
61
|
-
use_data_stream = data_stream_default(data_stream_params, invalid_data_stream_params
|
62
|
-
if
|
80
|
+
use_data_stream = data_stream_default(data_stream_params, invalid_data_stream_params)
|
81
|
+
if use_data_stream
|
82
|
+
@logger.info("Config is compliant with data streams. `data_stream => auto` resolved to `true`")
|
83
|
+
elsif data_stream_params.any?
|
63
84
|
# DS (auto) disabled but there's still some data-stream parameters (and no `data_stream => false`)
|
64
85
|
@logger.error "Ambiguous configuration; data stream settings are present, but data streams are not enabled", data_stream_params
|
65
86
|
raise LogStash::ConfigurationError, "Ambiguous configuration, please set data_stream => true " +
|
66
87
|
"or remove data stream specific settings: #{data_stream_params.keys}"
|
88
|
+
else
|
89
|
+
@logger.info("Config is not compliant with data streams. `data_stream => auto` resolved to `false`")
|
67
90
|
end
|
68
91
|
use_data_stream
|
69
92
|
end
|
@@ -93,6 +116,7 @@ module LogStash module Outputs class ElasticSearch
|
|
93
116
|
true
|
94
117
|
when 'data_stream'
|
95
118
|
value.to_s == 'true'
|
119
|
+
when 'ecs_compatibility' then true # required for LS <= 6.x
|
96
120
|
else
|
97
121
|
name.start_with?('data_stream_') ||
|
98
122
|
shared_params.include?(name) ||
|
@@ -110,8 +134,8 @@ module LogStash module Outputs class ElasticSearch
|
|
110
134
|
# @return [Gem::Version] if ES supports DS nil (or raise) otherwise
|
111
135
|
def assert_es_version_supports_data_streams
|
112
136
|
fail 'no last_es_version' unless last_es_version # assert - should not happen
|
113
|
-
es_version = Gem::Version.create(last_es_version)
|
114
|
-
if es_version < Gem::Version.create(DATA_STREAMS_ORIGIN_ES_VERSION)
|
137
|
+
es_version = ::Gem::Version.create(last_es_version)
|
138
|
+
if es_version < ::Gem::Version.create(DATA_STREAMS_ORIGIN_ES_VERSION)
|
115
139
|
@logger.error "Elasticsearch version does not support data streams, Logstash might end up writing to an index", es_version: es_version.version
|
116
140
|
# NOTE: when switching to synchronous check from register, this should be a ConfigurationError
|
117
141
|
raise LogStash::Error, "A data_stream configuration is only supported since Elasticsearch #{DATA_STREAMS_ORIGIN_ES_VERSION} " +
|
@@ -123,18 +147,28 @@ module LogStash module Outputs class ElasticSearch
|
|
123
147
|
DATA_STREAMS_ENABLED_BY_DEFAULT_LS_VERSION = '8.0.0'
|
124
148
|
|
125
149
|
# when data_stream => is either 'auto' or not set
|
126
|
-
|
127
|
-
|
150
|
+
# @param data_stream_params [#any?]
|
151
|
+
# @param invalid_data_stream_config [#any?#inspect]
|
152
|
+
def data_stream_default(data_stream_params, invalid_data_stream_config)
|
153
|
+
if ecs_compatibility == :disabled
|
154
|
+
@logger.debug("Not eligible for data streams because ecs_compatibility is not enabled. " + ENABLING_ECS_GUIDANCE)
|
155
|
+
return false
|
156
|
+
end
|
157
|
+
|
158
|
+
ds_default = ::Gem::Version.create(LOGSTASH_VERSION) >= ::Gem::Version.create(DATA_STREAMS_ENABLED_BY_DEFAULT_LS_VERSION)
|
128
159
|
|
129
160
|
if ds_default # LS 8.0
|
130
|
-
|
161
|
+
if invalid_data_stream_config.any?
|
162
|
+
@logger.debug("Not eligible for data streams because config contains one or more settings that are not compatible with data streams: #{invalid_data_stream_config.inspect}")
|
163
|
+
return false
|
164
|
+
end
|
131
165
|
|
132
166
|
@logger.debug 'Configuration is data stream compliant'
|
133
167
|
return true
|
134
168
|
end
|
135
169
|
|
136
170
|
# LS 7.x
|
137
|
-
if
|
171
|
+
if !invalid_data_stream_config.any? && !data_stream_params.any?
|
138
172
|
@logger.warn "Configuration is data stream compliant but due backwards compatibility Logstash 7.x will not assume " +
|
139
173
|
"writing to a data-stream, default behavior will change on Logstash 8.0 " +
|
140
174
|
"(set `data_stream => true/false` to disable this warning)"
|