-
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
Configurable line terminator #11015
Configurable line terminator #11015
Conversation
jenkins test this |
8583743
to
cf0da81
Compare
jenkins test this |
1 similar comment
jenkins test this |
6356a98
to
22089aa
Compare
jenkins test this |
3d5cab1
to
e472e04
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.
Looks like a breaking change. Old behavior did support \r\n
and \n
based line terminators. It used to split on \n
first and remove trailing \r\n
or \n
characters from the line.
This change seems to make it 'less' dynamic and this sense. What will be the default for Windows where \r\n
is more common?
It is indeed less dynamic. This PR requires the input file to use one kind of newline. Previously the following input file was readable:
Also if someone has different files with different newlines, e.g.
and
he/she was able to add it to the same input. By default on Windows the configured newline is To make the configuration backward compatible, a new option |
SGTM. Alternatively we can have 2 patterns. One 'split' pattern and one 'right-trim' pattern. This way we're not limited to newlines anymore, but could support more complex patterns for split based multiline. |
e472e04
to
1340348
Compare
This PR add a new input configuration option named
line_terminator
:The option
auto
tells Filebeat to use our current hybrid new line finder approach. Thus, we can avoid introducing a breaking change.It also contains a minor refactoring in
readfile
package. I have created a new typeConfig
which stores the configuration of the readers of the package. This eliminates a long list of parameters in the constructors ofEncodeReader
andLineReader
.Closes #5500