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 extractor date converters #11750
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If the converter fails for a timestamp value, run the fallback timestamp conversion, to ensure that a Message always has a valid timestamp.
Showing only the details is not helpful in some cases.
We don't need to call removeField before addField. It will just overwrite the value anyway. This avoids having to recalculate the message size twice. Only null values don't get set. Those we need to remove explicitly.
Converter compat review
mpfz0r
changed the title
Fix regression when using date converter #11495
Fix extractor date converters
Dec 8, 2021
mpfz0r
approved these changes
Dec 8, 2021
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 good 👍 Thanks for fixing this
mpfz0r
pushed a commit
that referenced
this pull request
Dec 8, 2021
* Fix regression when using date converter #11495 * get tests passing * Run timestamp fallback conversion If the converter fails for a timestamp value, run the fallback timestamp conversion, to ensure that a Message always has a valid timestamp. * Add tests * Improve gl2_processing_error message Showing only the details is not helpful in some cases. * Improve converter code We don't need to call removeField before addField. It will just overwrite the value anyway. This avoids having to recalculate the message size twice. Only null values don't get set. Those we need to remove explicitly. * adjust test to new processing error output * improve comments Co-authored-by: Marco Pfatschbacher <marco@graylog.com> (cherry picked from commit d12d846)
patrickmann
added a commit
that referenced
this pull request
Dec 9, 2021
* Fix regression when using date converter #11495 * get tests passing * Run timestamp fallback conversion If the converter fails for a timestamp value, run the fallback timestamp conversion, to ensure that a Message always has a valid timestamp. * Add tests * Improve gl2_processing_error message Showing only the details is not helpful in some cases. * Improve converter code We don't need to call removeField before addField. It will just overwrite the value anyway. This avoids having to recalculate the message size twice. Only null values don't get set. Those we need to remove explicitly. * adjust test to new processing error output * improve comments Co-authored-by: Marco Pfatschbacher <marco@graylog.com> (cherry picked from commit d12d846) Co-authored-by: Patrick Mann <patrickmann@users.noreply.github.com>
linuspahl
pushed a commit
that referenced
this pull request
Dec 13, 2021
* Fix regression when using date converter #11495 * get tests passing * Run timestamp fallback conversion If the converter fails for a timestamp value, run the fallback timestamp conversion, to ensure that a Message always has a valid timestamp. * Add tests * Improve gl2_processing_error message Showing only the details is not helpful in some cases. * Improve converter code We don't need to call removeField before addField. It will just overwrite the value anyway. This avoids having to recalculate the message size twice. Only null values don't get set. Those we need to remove explicitly. * adjust test to new processing error output * improve comments Co-authored-by: Marco Pfatschbacher <marco@graylog.com>
linuspahl
pushed a commit
that referenced
this pull request
Dec 13, 2021
* Fix regression when using date converter #11495 * get tests passing * Run timestamp fallback conversion If the converter fails for a timestamp value, run the fallback timestamp conversion, to ensure that a Message always has a valid timestamp. * Add tests * Improve gl2_processing_error message Showing only the details is not helpful in some cases. * Improve converter code We don't need to call removeField before addField. It will just overwrite the value anyway. This avoids having to recalculate the message size twice. Only null values don't get set. Those we need to remove explicitly. * adjust test to new processing error output * improve comments Co-authored-by: Marco Pfatschbacher <marco@graylog.com>
mpfz0r
added a commit
that referenced
this pull request
Dec 28, 2021
With #11149 we introduced a change that ensured that a message will have a valid DateTime as the timestamp field. The conversion or fallback (plus recording errors) was performed when setting the `timestamp` field. This caused problems (#11495) with date converters on extractors. They work by first assiging the non-converted timestamp string to the message, and then use this string in the date converter. A fix for this was done in #11750 However, looking at another user's issue with a json extractor (#11495 (comment)) made me rethink the previous approach. Our processing works by mutating a Message object and thus passing field values from one processing step to another. Enforcing a DateTime object on the timestamp field in the middle of the processing has the potential to break configurations where multiple steps are taken to convert a field. E.g. the json extractor will just assign a tempoarary timestamp string, which will later be converted using a pipeline rule. Therefore, we only perform timestamp conversion/fallback under two circumstances: - The processing is completed - An explicit call to Message.getTimestamp() is made
patrickmann
pushed a commit
that referenced
this pull request
Jan 4, 2022
With #11149 we introduced a change that ensured that a message will have a valid DateTime as the timestamp field. The conversion or fallback (plus recording errors) was performed when setting the `timestamp` field. This caused problems (#11495) with date converters on extractors. They work by first assiging the non-converted timestamp string to the message, and then use this string in the date converter. A fix for this was done in #11750 However, looking at another user's issue with a json extractor (#11495 (comment)) made me rethink the previous approach. Our processing works by mutating a Message object and thus passing field values from one processing step to another. Enforcing a DateTime object on the timestamp field in the middle of the processing has the potential to break configurations where multiple steps are taken to convert a field. E.g. the json extractor will just assign a tempoarary timestamp string, which will later be converted using a pipeline rule. Therefore, we only perform timestamp conversion/fallback under two circumstances: - The processing is completed - An explicit call to Message.getTimestamp() is made
mpfz0r
added a commit
that referenced
this pull request
Jan 5, 2022
With #11149 we introduced a change that ensured that a message will have a valid DateTime as the timestamp field. The conversion or fallback (plus recording errors) was performed when setting the `timestamp` field. This caused problems (#11495) with date converters on extractors. They work by first assiging the non-converted timestamp string to the message, and then use this string in the date converter. A fix for this was done in #11750 However, looking at another user's issue with a json extractor (#11495 (comment)) made me rethink the previous approach. Our processing works by mutating a Message object and thus passing field values from one processing step to another. Enforcing a DateTime object on the timestamp field in the middle of the processing has the potential to break configurations where multiple steps are taken to convert a field. E.g. the json extractor will just assign a tempoarary timestamp string, which will later be converted using a pipeline rule. Therefore, we only perform timestamp conversion/fallback under two circumstances: - The processing is completed - An explicit call to Message.getTimestamp() is made (cherry picked from commit 7bdef92)
patrickmann
pushed a commit
that referenced
this pull request
Jan 5, 2022
With #11149 we introduced a change that ensured that a message will have a valid DateTime as the timestamp field. The conversion or fallback (plus recording errors) was performed when setting the `timestamp` field. This caused problems (#11495) with date converters on extractors. They work by first assiging the non-converted timestamp string to the message, and then use this string in the date converter. A fix for this was done in #11750 However, looking at another user's issue with a json extractor (#11495 (comment)) made me rethink the previous approach. Our processing works by mutating a Message object and thus passing field values from one processing step to another. Enforcing a DateTime object on the timestamp field in the middle of the processing has the potential to break configurations where multiple steps are taken to convert a field. E.g. the json extractor will just assign a tempoarary timestamp string, which will later be converted using a pipeline rule. Therefore, we only perform timestamp conversion/fallback under two circumstances: - The processing is completed - An explicit call to Message.getTimestamp() is made (cherry picked from commit 7bdef92)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
#11149 introduced a regression with regard to date converter. This breaks scenarios that use the date converter to assign a non-standard date to the
timestamp
field.With this PR, the date converter again works as it did in 4.1, while preserving the newly added functionality from 4.2 (with regard to
timestamp
).Resolves #11495