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

rework rsyslog startup wait for /var/log mounting #242

Merged
merged 1 commit into from
Oct 27, 2022

Conversation

ramonskie
Copy link
Contributor

some iaases are slower to mount the log disk for example aws

solves #241

@ramonskie
Copy link
Contributor Author

@rkoster rkoster requested review from a team, lnguyen, bgandon, beyhan and cunnie and removed request for a team, lnguyen, bgandon, beyhan and cunnie October 13, 2022 14:29
@rkoster rkoster marked this pull request as draft October 13, 2022 14:37
@aramprice aramprice requested review from aramprice and removed request for aramprice October 13, 2022 14:39
Copy link
Member

@aramprice aramprice left a comment

Choose a reason for hiding this comment

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

I'm not familiar with systemd but the spirit / direction of the changes make sense

@aramprice aramprice self-requested a review October 13, 2022 14:42
Copy link
Member

@cunnie cunnie left a comment

Choose a reason for hiding this comment

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

Hey @ramonskie — I love this commit! Thank you.

Could you please squash these two commits into one? And re-work the commit message. I'm looking for something like this (you can cut-and-paste if you're feeling lazy):

rsyslogd runs on Jammy

Prior to this commit, `rsyslogd`, the logging daemon, was not running on Jammy-based
stemcells even though it should be running.

This commit addresses the issue by enabling `rsyslogd` via systemd control files. 
Furthermore, we took the opportunity to remove dead code which had been 
commented-out long ago.

We also streamline the start-up process: we no longer have a contorted method
to determine if /var/log is mounted; instead, we use the much-simpler
`After=var-log.mount`.

@rkoster
Copy link
Contributor

rkoster commented Oct 13, 2022

@aramprice and @cunnie, forgot to update both of you. This PR was discussed at the last working group meeting. Apparently the changes were tested against the wrong stemcell and do not work with jammy yet. Which is why the PR was converted to draft again.

@ramonskie
Copy link
Contributor Author

i investigated it further and it seems that journald gets borked on aws stemcells.
ong gcp journaldwork just fine

running a systemctl status systemd-journald* shows all service green
but when running systemctl --verify it fails.
after restarting it it works fine systemctl restart systemd-journald.service

i have no idea why this fails on the first startup.

@ramonskie ramonskie removed the request for review from aramprice October 20, 2022 14:43
@ramonskie ramonskie marked this pull request as ready for review October 20, 2022 14:44
@ramonskie
Copy link
Contributor Author

rsyslogd is now enabled by default as we do have a preexec check now before its even able to start.
i think in the past this was disabled as the syslog socket would enable it in a later state.
but it seems this behavior has changed.

i also tried to use the following systemd options for rsyslog.service but i could not get it to behave so that rsyslog would start later than the the mounting of var/log

[Unit]
After=network.target var-log.mount
Require=network.target var-log.mount
RequiresMountsFor=/var/log

some references about journald in bosh eco system:
cloudfoundry/bosh-agent#241

Copy link
Member

@cunnie cunnie left a comment

Choose a reason for hiding this comment

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

Hey @ramonskie , thanks for fixing rsyslogd — I was annoyed that I had to manually start it on my newly-deployed Director.

Could you please re-work the first commit message. I'm looking for something like this (you can cut-and-paste if you're feeling lazy):

rsyslogd runs on Jammy

Prior to this commit, `rsyslogd`, the logging daemon, was not running on
Jammy-based stemcells even though it should be running.

We also had to make sure that `rsyslogd` was logging _all_ the logs, especially
the ones emitted by the systemd Journal (`journald` or `systemd-journald`).

A challenge we had to overcome was that `journald` stopped when the BOSH agent
mounted `/var/log` early in the boot process; our fix was to configure
`journald` to write to volatile storage (`/run/log/journal/`) instead of
persistent (`/var/log/journal`). This did not jeopardize the logs; `journald`
forwards its logs to `rsyslogd` via a socket. We also configure `rsyslogd` to
wait until `/var/log` has been mounted before starting.

Prior to this commit, `rsyslogd`, the logging daemon, was not running on
Jammy-based stemcells even though it should be running.

We also had to make sure that `rsyslogd` was logging _all_ the logs, especially
the ones emitted by the systemd Journal (`journald` or `systemd-journald`).

A challenge we had to overcome was that `journald` stopped when the BOSH agent
mounted `/var/log` early in the boot process; our fix was to configure
`journald` to write to volatile storage (`/run/log/journal/`) instead of
persistent (`/var/log/journal`). This did not jeopardize the logs; `journald`
forwards its logs to `rsyslogd` via a socket. We also configure `rsyslogd` to
wait until `/var/log` has been mounted before starting.
@ramonskie
Copy link
Contributor Author

@cunnie i adjusted the commit message. and as your text was already perfect (and im a little lazy)
i just used yours :)

Copy link
Member

@cunnie cunnie left a comment

Choose a reason for hiding this comment

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

LGTM

@ramonskie ramonskie removed the request for review from aramprice October 27, 2022 08:32
@rkoster rkoster merged commit 06a159a into ubuntu-jammy/master Oct 27, 2022
@rkoster rkoster deleted the ubuntu-jammy/rsyslog-fix branch October 27, 2022 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants