-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Limit usage of the deprecated log
and container
inputs
#42295
base: main
Are you sure you want to change the base?
Conversation
The log input has been depredated since 7.16, it's time to disable it. The container input is just an alias/preset for the log input. They still can be used under the following circumstances: * When running under Elastic Agent (by integrations) * When running as a part of a module * When `allow_deprecated_use` is set as a part of the the input configuration
6401032
to
f1a1aa3
Compare
99d4d76
to
1f497a9
Compare
1f497a9
to
ba5df37
Compare
4fb2853
to
41e6772
Compare
508685e
to
6de94ca
Compare
a9aa39c
to
6aa00a4
Compare
4dd7477
to
b8d927c
Compare
b8d927c
to
265dda8
Compare
@@ -217,6 +217,7 @@ def test_wrong_module_no_reload(self): | |||
self.render_config_template( | |||
reload=False, | |||
reload_path=self.working_dir + "/configs/*.yml", | |||
reload_type="modules", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a bug, just luck that this test worked before.
@@ -227,6 +228,7 @@ def test_wrong_module_no_reload(self): | |||
test: | |||
enabled: true | |||
wrong_field: error | |||
var.paths: [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test was broken, this was missing and the test was expecting an error for empty paths.
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just missing integration tests for both cases: standalone and under Elastic-Agent.
@@ -1,4 +1,4 @@ | |||
type: log | |||
type: filestream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every Filestream instance must have a unique ID, even for tests and examples it's better to always add it.
type: filestream | |
type: filestream | |
id: foo-multi |
@@ -1,4 +1,4 @@ | |||
type: log | |||
type: filestream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here
type: filestream | |
type: filestream | |
id: foo-multibad |
|
||
The following example configures {beatname_uc} to harvest lines from all log files that match the specified glob patterns: | ||
|
||
["source","yaml",subs="attributes"] | ||
------------------------------------------------------------------------------------- | ||
{beatname_lc}.inputs: | ||
- type: log | ||
- type: filestream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- type: filestream | |
- type: filestream | |
id: unique-ID |
@@ -3,6 +3,12 @@ | |||
[id="{beatname_lc}-input-{type}"] | |||
=== Container input | |||
|
|||
deprecated:[7.16.0] | |||
|
|||
The container input is deprecated. Please use the the <<filebeat-input-filestream,`filestream input`>> and its <<filebeat-input-filestream-parsers-container,`container`>> parser. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if we should add an example configuration here, there are a couple of pitfalls when using Filestream to ingest container data:
- The ID must be unique
- Following symlinks needs to be enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
@@ -58,6 +58,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff] | |||
- Filestream inputs with duplicated IDs will fail to start. An error is logged showing the ID and the full input configuration. {issue}41938[41938] {pull}41954[41954] | |||
- Filestream inputs can define `allow_deprecated_id_duplication: true` to run keep the previous behaviour of running inputs with duplicated IDs. {issue}41938[41938] {pull}41954[41954] | |||
- The Filestream input only starts to ingest a file when it is >= 1024 bytes in size. This happens because the fingerprint` is the default file identity now. To restore the previous behaviour, set `file_identity.native: ~` and `prospector.scanner.fingerprint.enabled: false` {issue}40197[40197] {pull}41762[41762] | |||
- Filebeat fails to start when its configuration contains usage of the deprecated `log` or `container` inputs {pull}42295[42295] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth mentioning the allow_deprecated_use
flag here directly.
@@ -3,6 +3,12 @@ | |||
[id="{beatname_lc}-input-{type}"] | |||
=== Container input | |||
|
|||
deprecated:[7.16.0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a retroactive deprecation isn't it? There's no deprecation warning right now https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-input-container.html
We are the only people who know this is the log input underneath, we should explain we consider this deprecated because it is just the log input underneath and can be replaced by filestream directly.
@@ -3,6 +3,12 @@ | |||
[id="{beatname_lc}-input-{type}"] | |||
=== Container input | |||
|
|||
deprecated:[7.16.0] | |||
|
|||
The container input is deprecated. Please use the the <<filebeat-input-filestream,`filestream input`>> and its <<filebeat-input-filestream-parsers-container,`container`>> parser. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
// AllowDeprecatedUse returns true if the configuration allows using the deprecated log input | ||
func AllowDeprecatedUse(cfg *conf.C) bool { | ||
allow, _ := cfg.Bool(allowDeprecatedUseField, -1) | ||
return allow || fleetmode.Enabled() || fileset.CheckIfModuleInput(cfg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we want to always allow the log input when its run by agent? Every standalone agent configuration will bypass the need for the allow_deprecated_use flag?
Can't we just add this flag to every integration in https://github.com/elastic/integrations/ that uses log or one of its aliases?
The log input has been deprecated since 7.16, it's time to disable it. The container input is just an alias/preset for the log input.
They still can be used under the following circumstances:
allow_deprecated_use
is set as a part of the the input configurationChecklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Disruptive User Impact
Users who are still using the deprecated
log
andcontainer
inputs in their hand-crafted configuration will see the error message on Filebeat's startup.How to test this PR locally
Running log input in the user-crafted configuration fails
filebeat.yml
This configuration produces the following error message:
Similar for the
container
input:Setting
allow_deprecated_use: true
enables thelog
inputfilebeat.yml
These configurations run without the error.
log
input still runs as a part of a moduleFor example, the postgresql module is using the
log
input:beats/filebeat/module/postgresql/log/config/log.yml
Line 1 in ef3bd69
If we try to start this module via the configuration, Filebeat produces no error:
filebeat.yml
log
input still runs as a part of an integration (Elastic Agent)I ran the agent packaging with the Beats being on this branch:
Verified that the packaged
agentbeat
contains the code from this branch:filebeat.yml
and it failed as expected:
I use "Custom Logs" integration for the next test because it's based on the log input:
https://github.com/elastic/integrations/blob/a957144c41043e28e7effa343d4619f00f4deef3/packages/log/manifest.yml#L19
I created a cloud deployment and enrolled my custom agent to the Fleet with the "Custom Logs" integration.
I saw in the logs that the log input was running
I saw the incoming data in Kibana too: