Skip to content
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 10 commits into from
Nov 10, 2016
Merged

F/fix internal msg timestamps #1233

merged 10 commits into from
Nov 10, 2016

Conversation

bazsi
Copy link
Collaborator

@bazsi bazsi commented Oct 16, 2016

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.

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;
Copy link
Collaborator

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)

@juhaszviktor
Copy link
Collaborator

Aside from the magic number in the test (was just a very minor note), it looks good to me 👍

…ultiplication

Signed-off-by: Viktor Juhasz <viktor.juhasz@balabit.com>
@kvch kvch merged commit 90e0554 into master Nov 10, 2016
@kvch kvch removed the needs-review label Nov 10, 2016
@bazsi bazsi deleted the f/fix-internal-msg-timestamps branch August 15, 2017 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants