-
Notifications
You must be signed in to change notification settings - Fork 462
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
F/fix internal msg timestamps #1233
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
The default value of "-1" is represented as a date before epoch, make sure that a specific date is set instead. Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
We could add %f to our strptime() implementation as we have one anyway, but until that happens we simply set tv_usec to 0. '%f' as a sequence in strptime was introduced by Python. Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
In some cases, the syslog parser didn't completely set zone_offset and tv_usec values, causing earlier values to be leaked through. This patch changes that and ensures that syslog-parser always overwrites all log stamp specific fields. Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
This patch removes the extremal values (e.g. -1) for timestamps[LM_TS_STAMP].tv_sec that indicates that the timestamp is unset. Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
Since the LogMessage constructors already set that value, we don't need to do on our own. Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
As at this point the syslog-parser or the log_msg_new() constructors always fill the timestamp of a message, remove code that checks for extremal values. Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
@@ -62,6 +62,8 @@ create_message_with_fields(const char *field_name, ...) | |||
va_list args; | |||
const char *arg; | |||
LogMessage *msg = log_msg_new_empty(); | |||
|
|||
msg->timestamps[LM_TS_STAMP].tv_sec = 31536000; |
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 "magic" value somehow could be described.
I know, that this is a year, but we should use a define or use a multiplication (365 * 24 * 3600)
Aside from the magic number in the test (was just a very minor note), it looks good to me 👍 |
kvch
approved these changes
Oct 24, 2016
…ultiplication Signed-off-by: Viktor Juhasz <viktor.juhasz@balabit.com>
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.
This patch should fix the timestamp issue for suppression messages, reported by
Scot Needy scotrn@gmail.com on the mailing list.
This revamps how timestamps are initialized/parsed, so the code becomes less coupled.