Systemd service help

So the mariadb.server is set by default to start after syslog.target…

But rsyslog.service fails to connect to the database since it starts before the DB.

Whats best way to solve this without creating some kind of loop??

how are you auto starting your database?

It should have been something like"

sudo systemctl enable mariadb

If you need to edit the service file you will need to update the requires to start after rsyslog’s group.

Yeah. Mariadb is enabled… and does start on boot… but since it starts after rsyslog… rsyslog fails to connect to the DB… until I login and restart it.

You will have to add mariadb as a dependency to service unit file for rsyslog. You can use the “After=” directive to add dependencies. Here is some documentation about it https://www.freedesktop.org/software/systemd/man/systemd.unit.html

1 Like

But mariadb has an after directive for syslog.target… so wouldnt adding an after directive to rsyslog cause a loop??

@gaga

If rsyslog is using mariadb as the backend and mariadb wants to log to rsyslog, it seems like that isn’t possible unless mariadb can either delay writing the logs or just log to a flat file.