-
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
Fix ignoring external input configuration in take_over: true
mode
#36395
Conversation
6937e9b
to
76308e9
Compare
The take-over mode didn't take into account external configuration files. Now it's reading the merged configuration that contains the externally defined inputs too.
76308e9
to
94874d7
Compare
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 OK with the code change.
For tests, because processLogInputTakeOver
happens before the InputLoader
, it might be a good idea to have a test that shows what happens if the input config is wrong or not parsable somehow.
This pull request is now in conflicts. Could you fix it? 🙏
|
@leehinman since all this new code does not really parse the input configuration and keeps it as raw config, nothing would fail on invalid configuration, unless YAML syntax error. When the actual take over is happening the input configuration is parsed into a short verion of the input configuration beats/filebeat/input/filestream/takeover/config.go Lines 20 to 48 in 9dcd8be
And required data is validated there. As long as it has the right input type, paths and beats/filebeat/input/filestream/takeover/takeover.go Lines 148 to 155 in 9dcd8be
And this is tested here beats/filebeat/input/filestream/takeover/takeover_test.go Lines 172 to 187 in 9dcd8be
If the input loader performs extra validation and fails later it's okay, the migration is done anyway and it's well communicated in the debug logs. |
…lastic#36395) The take-over mode didn't take into account external configuration files. Now it's reading the merged configuration that contains the externally defined inputs too.
filebeat 8.15.0. problem returned. |
Hello @fixed77 |
The take-over mode didn't take into account external configuration files. Now it's reading the merged configuration that contains the externally defined inputs too.
Checklist
- [ ] I have made corresponding changes to the documentation- [ ] I have made corresponding change to the default configuration filesCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.How to test this PR locally
/test/config/inputs.d
:filebeat-before.yml
filebeat-after.yml.disabled
/test/config/filebeat.yml
Note, you need to adjust the root path
/test
to your own.Create the log files in
/test/logs
with any lines you'd like, the filenames areerror1.log
,error2.log
anderror3.log
.Run filebeat with the following script (you can override the
FILEBEAT_ROOT
variable:You should see events according to the lines written to the log files, in my case it's:
take_over: true
, for that:Switch the main config to:
Note, we switched the input to filestream.
Rename the files:
filebeat-after.yml.disabled
->filebeat-after.yml
filebeat-before.yml
->filebeat-before.yml.disabled
output.json
, it should contain the following log lines:error1.log
,error2.log
anderror3.log
files and make sure you see the events from filestream on the console, like this one:Related issues
take_over: true
is ignored when using input configuration from external files #36378