Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
when return nil here, will the input stop?
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.
yes
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.
OK I tested it with only
aws-s3
input and here is what's in the log:But with the
aws-s3
input stopped, Filebeat is still running. Is that expected? For the other validations done in thisValidate
function, if validation didn't pass, it returns the error and Filebeat stops.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.
That's because
Validate
will pass if neitherqueue_url
norbucket_arn
is set.I change this behaviour after report on #23226 (comment)
Since we cannot control all users' config we would risk a lot of setup updated to
7.15
starting to fail to start Filebeat because they haveaws
module defined with no all the filesets not actually used set toenable: false
This shouldn't affect filesets in
aws
module that are already setup properly withqueue_url
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.
@kaiyan-sheng the original behaviour is to no stop Filebeat if an aws fileset is not defined, and we already have "strange" log entries when this happens:
the behaviour will be the same and the log entry will be replace with:
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, as far as I can see it, is that we cannot control what aws module's config users have defined, with or without every filesets defined with
enabled: false
The source of the problem resides on https:/elastic/beats/blob/master/filebeat/fileset/modules.go#L75 and https:/elastic/beats/blob/master/filebeat/fileset/modules.go#L83, where we set an empty
FilesetConfig
havingFilesetConfig.Enabled = nil
and then we check forFilesetConfig.Enabled != nil && !(*fcfg.Enabled)
.Changing to
fcfg = &FilesetConfig{Enabled: new(bool) }
, would be probably the right solution, but I can see a similar change in behaviour (https:/elastic/beats/pull/27526/files) was decided to be breaking and will happen only on8.x
[1]Excluding the change there, and assuming we don't want to have updates to
7.15
for filebeat stop starting (given custom users' config with no fileset defined), I cannot see any other way to prevent than the "fix" in this PR (I've tried changing the config rendering so to not fail to start, and even if possible in the end the result wouldn't be different than logging a strange message that something is not properly configured)Before
queue_url
was always rendered in the fileset config, as<no value>
if the fileset was not defined at all.Now either
queue_url
orbucket_arn
will be rendered according to which one of the relatedvar
is defined.Since both of them can not being defined, and the fileset won't be skipped for validation, the less disruptive way I found would be to not fail config validation in this case.
The case was reported in #23226
@exekias hope you have more context
[1] This would be my preferred fix if possible to backport
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.
Sorry for the late reply,
Ideally a wrong config would end up in an error, which would make Filebeat stop.
I understand the concern around the change to current behavior, and it seems we cannot implement this error in a backwards compatible way, at least for 7.15. What about doing this change as it is now and enabling the error once #27526 goes in?
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 agree, the problem here is that it could be both a true positive error (fileset defined with no queue_url or bucket_arn) or a false positive one (fileset not defined), we have to decide what's most destructive
for me it's fine, but this means targeting 8.x
@kaiyan-sheng ?
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.
@exekias Thanks for your input. @aspacca Targeting 8.x sounds good to me. Maybe we can add a warning in the documentation for now?