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/syslog parser fixes #1206

Merged
merged 6 commits into from
Sep 20, 2016
Merged

F/syslog parser fixes #1206

merged 6 commits into from
Sep 20, 2016

Conversation

bazsi
Copy link
Collaborator

@bazsi bazsi commented Sep 11, 2016

This branch contains two pretty important fixes to syslog-parser():

  1. all structured data elements were parsed as the empty string (due to an error in MsgFormatOptions initialization)

  2. partial timestamps were not always parsed properly

Please merge!

This function can be used to copy MsgFormat related options during for
instance a _clone() operation. Such an example follows in the syslog-parser()
as the subsequent patch.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
The syslog parser supports msg-format related options and albeit the code
has a lot of smells in the area (beginning with all the syslog related
settings in MsgFormatOptions), we should make an effort to use them.

To do that, we need to set defaults, and initialize/destroy these options
properly.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
The LM_TS_STAMP is already filled by the time we get to syslog-parser(),
however we do want to fully parse the date. One case that was missing was
when the input timestamp didn't have a timezone and the syslog-parser()
did have a time-zone() option specified. The correct behaviour is to
use the timezone specified in options, however since it was already parsed
earlier, it wasn't the case.

Signed-off-by: Balazs Scheidler <balazs.scheidler@balabit.com>
@bazsi
Copy link
Collaborator Author

bazsi commented Sep 11, 2016

@csabamajor, I think this is of interest to you.

@@ -32,10 +32,22 @@ syslog_parser_process(LogParser *s, LogMessage **pmsg, const LogPathOptions *pat
LogMessage *msg;

msg = log_msg_make_writable(pmsg, path_options);

msg->timestamps[LM_TS_STAMP].tv_sec = -1;
msg->timestamps[LM_TS_STAMP].zone_offset = -1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And what about tv_usec?

@bkil-syslogng
Copy link
Contributor

Otherwise seems good.

Signed-off-by: Laszlo Budai <stentor.bgyk@gmail.com>
Signed-off-by: Laszlo Budai <stentor.bgyk@gmail.com>
Signed-off-by: Laszlo Budai <stentor.bgyk@gmail.com>
@lbudai
Copy link
Collaborator

lbudai commented Sep 20, 2016

@bazsi: I've updated your branch with some changes
@bkil-syslogng , @kvch , @juhaszviktor , @MrAnno : could you check the PR and merge ASAP? :-)

@kvch kvch merged commit 78eae8a into master Sep 20, 2016
@kvch kvch removed the needs-review label Sep 20, 2016
@bazsi bazsi deleted the f/syslog-parser-fixes 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

4 participants