-
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
Filebeat: Have filesets disabled unless explicitly configured #27526
Conversation
Pinging @elastic/security-external-integrations (Team:Security-External Integrations) |
Pinging @elastic/integrations (Team:Integrations) |
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪💚 Flaky test reportTests succeeded. Expand to view the summary
Test stats 🧪
|
I love this change, but it can be breaking in some cases. Does this change target 8.0, or you propose to backport it for 7.x? |
@jsoriano this targets 8.0 |
/test |
@adriansr |
Thank you @adriansr for working on this change! With this change, do we still require
|
6c5274a
to
ef06c44
Compare
@aspacca that's a good question. I've been going through the default configurations and applied the following:
This results in the following modules having all filesets disabled in their default config:
All other modules keep their filesets enabled by default. Maybe this is too confusing and we should make everything disabled by default? |
I would rather disabled everything by default (unless part of module enabled by default): I see that if users are enabling a module probably they have to configure it and marking the related filesets as enabled as a part of the configuration That's mainly because an enabled fileset that's not properly configured, while not breaking Filebeat (preventing it to start for example) will probably produces some logs about the misconfiguration that could be confusing for the users: see #27612 for an use case we just found |
This pull request is now in conflicts. Could you fix it? 🙏
|
2282954
to
0110d24
Compare
This changes fileset loading so that only filesets that are explicitly defined in the configuration are enabled. Until now, an enabled module will have all its filesets enabled unless explicitly disabled, which makes for a bad user experience with modules that contain a lot of filesets. Closes elastic#17256
0110d24
to
6560033
Compare
I've removed the changes to the default configuration files and will follow up with a separate PR that changes all modules' configurations to |
} | ||
|
||
// check that no extra filesets are configured | ||
for filesetName, fcfg := range mcfg.Filesets { | ||
if fcfg.Enabled != nil && !(*fcfg.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.
due to https://github.com/elastic/beats/pull/27526/files#diff-515d023121b7ec77d64c2a0cfcfe3dc6f9b46e19166e71ac34e5f5cf74fddfe6L74-L76 we could have a case where fcfg.Enabled = nil
and the fileset was not skipped.
now fcfc
comes from defined filesets: https://github.com/elastic/beats/pull/27526/files#diff-515d023121b7ec77d64c2a0cfcfe3dc6f9b46e19166e71ac34e5f5cf74fddfe6R72, but still it can be the case that enabled: false
is not defined.
I'd change this to if fcfg.Enabled == nil || !(*fcfg.Enabled)
what do you think @adriansr ?
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 PR maintains the current behavior of the enabled flag: If it's not defined, it defaults to true
. So enabled==nil || *enabled
is the true check, and enabled!=nil && !(*enabled)
is the false check.
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.
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.
The problem with this change is that it introduces another breaking change, and will potentially break existing configurations for our users. Also it makes configuring filesets from the command line more complicated as it forces users to always include an enabled flag -M mymodule.mydataset.enabled=true
.
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 understand your concern, it is actually a breaking change.
The problem I see in enabling by default if not explicitly disabled is that we miss the chance to enforce stricter validation on filesets where there is not a default not failing config (see #27612 ).
In the specific case there's no option to either prevent filebeat from starting if we introduce the validation, or let it start with a misconfigured explicitly enabled fileset that will stop as input.
Also what we have as current behaviour is the possibility of filesets starting and stopping because "implicitly" enabled and not properly configured, producing noisy logs that could be confusing.
Hard choice to take, indeed
This pull request is now in conflicts. Could you fix it? 🙏
|
/test |
What does this PR do? Changes the default configuration for Filebeat's filesets to make them disabled by default (enabled: false). Adds a check to the config and update targets of mage to check that default configurations have an explicit disable: > error: in file 'modules.d/checkpoint.yml.disabled': checkpoint module > dataset firewall must be explicitly disabled (needs enabled: false) Why is it important? The previous default of having all filesets enabled, paired with the configuration loader enabling all non-explicitly-disabled filesets (changed in #27526) has been causing trouble for our users for quite some time.
…c#27526) This changes fileset loading so that only filesets that are explicitly defined in the configuration are enabled. Until now, an enabled module will have all its filesets enabled unless explicitly disabled, which makes for a bad user experience with modules that contain a lot of filesets. Closes elastic#17256
…c#27762) What does this PR do? Changes the default configuration for Filebeat's filesets to make them disabled by default (enabled: false). Adds a check to the config and update targets of mage to check that default configurations have an explicit disable: > error: in file 'modules.d/checkpoint.yml.disabled': checkpoint module > dataset firewall must be explicitly disabled (needs enabled: false) Why is it important? The previous default of having all filesets enabled, paired with the configuration loader enabling all non-explicitly-disabled filesets (changed in elastic#27526) has been causing trouble for our users for quite some time.
Since elastic#27526 and elastic#27762, Filebeat will have all filesets disabled by default. To prevent user confusion, a warning message to alert the user of a configured module without any enabled filesets was added. However, due to Filebeat internals, this message will only appear for modules configured from the command-line (--modules flag). This updates the code to ensure it works also for modules configured via modules.d directory and turns the warning into a hard-error that prevents startup.
Since #27526 and #27762, Filebeat will have all filesets disabled by default. To prevent user confusion, a warning message to alert the user of a configured module without any enabled filesets was added. However, due to Filebeat internals, this message will only appear for modules configured from the command-line (--modules flag). This updates the code to ensure it works also for modules configured via modules.d directory and turns the warning into a hard-error that prevents startup.
Since #27526 and #27762, Filebeat will have all filesets disabled by default. To prevent user confusion, a warning message to alert the user of a configured module without any enabled filesets was added. However, due to Filebeat internals, this message will only appear for modules configured from the command-line (--modules flag). This updates the code to ensure it works also for modules configured via modules.d directory and turns the warning into a hard-error that prevents startup. (cherry picked from commit 707ed1d)
Since #27526 and #27762, Filebeat will have all filesets disabled by default. To prevent user confusion, a warning message to alert the user of a configured module without any enabled filesets was added. However, due to Filebeat internals, this message will only appear for modules configured from the command-line (--modules flag). This updates the code to ensure it works also for modules configured via modules.d directory and turns the warning into a hard-error that prevents startup. (cherry picked from commit 707ed1d) Co-authored-by: Adrian Serrano <[email protected]>
What does this PR do?
This changes fileset loading so that only filesets that are explicitly defined in the configuration are enabled.
Why is it important?
Until now, an enabled module will have all its filesets enabled unless they are explicitly disabled, which makes for a bad user experience for modules that contain a lot of filesets.
This will break existing configurations where a module is enabled without explicitly enabling any fileset. For example the following configuration suggested by our docs:
This is updated to:
To alert users when a broken configuration like this is detected, the following warning log will be emitted:
Checklist
[ ] I have made corresponding change to the default configuration filesCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Related issues
Closes #17256
Related to #11943