You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve log messages for data stream support checks (#1109)
This commit changed the data-stream log messages providing more context on configuration issues and incompatible settings.
The check_data_stream_config! method was refactored to reduce its cyclomatic complexity. It also changed the data_stream_default log levels from debug to info as those messages are helpful in understanding the auto-configuration mechanism and troubleshooting possibly incompatible values.
Prior to this commit, a few data stream logs were being printed twice due to a race condition on the data_stream_config? method.
@logger.error"Ambiguous configuration; data stream settings must not be present when data streams is disabled (caused by: `data_stream => false`)",data_stream_params
62
-
raiseLogStash::ConfigurationError,"Ambiguous configuration, please remove data stream specific settings: #{data_stream_params.keys}"
63
-
end
56
+
check_disabled_data_stream_config!(params)
64
57
returnfalse
65
58
whentrue
66
-
ifinvalid_data_stream_params.any?
67
-
@logger.error"Invalid data stream configuration, following parameters are not supported:",invalid_data_stream_params
68
-
raiseLogStash::ConfigurationError,"Invalid data stream configuration: #{invalid_data_stream_params.keys}"
69
-
end
70
-
ifecs_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
-
raiseLogStash::ConfigurationError,"Invalid data stream configuration: `ecs_compatibility => disabled`"
@logger.error"Invalid data stream configuration, the following parameters are not supported:",invalid_data_stream_params
76
+
raiseLogStash::ConfigurationError,"Invalid data stream configuration: #{invalid_data_stream_params.keys}"
77
+
end
78
+
79
+
ifecs_compatibility == :disabled
80
+
ifecs_compatibility_required?
81
+
@logger.error"Invalid data stream configuration; `ecs_compatibility` must not be `disabled`. " + ENABLING_ECS_GUIDANCE
82
+
raiseLogStash::ConfigurationError,"Invalid data stream configuration: `ecs_compatibility => disabled`"
90
83
end
91
-
use_data_stream
84
+
85
+
@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
92
86
end
93
87
end
94
88
89
+
defcheck_disabled_data_stream_config!(params)
90
+
data_stream_params=data_stream_params(params)
91
+
92
+
ifdata_stream_params.any?
93
+
@logger.error"Ambiguous configuration; data stream settings must not be present when data streams are disabled (caused by `data_stream => false`, `data_stream => auto` or unset resolved to false). " \
94
+
"You can either manually set `data_stream => true` or remove the following specific data stream settings: ",data_stream_params
95
+
96
+
raiseLogStash::ConfigurationError,
97
+
"Ambiguous configuration; data stream settings must not be present when data streams are disabled: #{data_stream_params.keys}"
@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}")
167
+
ifdata_stream_and_ecs_enabled_by_default?
168
+
ifinvalid_data_stream_params.any?
169
+
@logger.info("Not eligible for data streams because config contains one or more settings that are not compatible with data streams: #{invalid_data_stream_params.inspect}")
163
170
returnfalse
164
171
end
165
172
166
-
@logger.debug'Configuration is data stream compliant'
167
173
returntrue
168
174
end
169
175
170
176
# LS 7.x
171
-
if !invalid_data_stream_config.any? && !data_stream_params.any?
177
+
if !invalid_data_stream_params.any? && !data_stream_params(params).any?
172
178
@logger.warn"Configuration is data stream compliant but due backwards compatibility Logstash 7.x will not assume " +
173
179
"writing to a data-stream, default behavior will change on Logstash 8.0 " +
174
180
"(set `data_stream => true/false` to disable this warning)"
Copy file name to clipboardExpand all lines: logstash-output-elasticsearch.gemspec
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
Gem::Specification.newdo |s|
2
2
s.name='logstash-output-elasticsearch'
3
-
s.version='11.12.2'
3
+
s.version='11.12.3'
4
4
s.licenses=['apache-2.0']
5
5
s.summary="Stores logs in Elasticsearch"
6
6
s.description="This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
0 commit comments