5

I have a program which needs syslog to run to correctly work. I am working in an Alpine container with version 3.16.0. As I'm getting multiple errors from the program (weewx), I understood that syslog is not running in the container, so I researched how I should run it, with little success.

After installing openrc (apk add --no-cache openrc) I tried to add it as a service as it is suggested on the Alpine wiki, however after running rc-update add syslogd boot I got this error:

rc-update: service `syslogd' does not exist

I don't have a lot of experience with services, so I decided to ask. What should be the right approach to have syslogd run as a daemon when the container is launched? Right now to get it to run I launch it manually, however it would be great to have it run automatically.

Thanks!

2 Answers 2

3

I just ran into this and am a little disappointed that this has been unanswered for 7 months and isn't already covered by the Alpine wiki.

  1. The command is actually rc-update add syslog boot, not syslogd
  2. If you haven't already, on Alpine < 3.17, you need to add openrc and busybox-initscripts with apk add openrc busybox-initscripts. On Alpine >= 3.17, you can add a single package apk add busybox-openrc
2

I went through some strange ritual to somehow start system logging. I needed to track authorization through the PAM service.

My commands:

run --privileged ... image

Commands in container

apk add syslog-ng busybox-openrc rc-update add syslog boot rc-status touch /run/openrc/softlevel rc-service syslog start rc-service syslog status 

Then I tracked the logs in the file /var/log/messages

(UPDATE)
Can run in unprivileged mode

Dockerfile

RUN <<EOF apk add syslog-ng busybox-openrc rc-update add syslog boot EOF 

entrypoint.sh

rc-status touch /run/openrc/softlevel rc-service syslog start rc-service syslog status 

docker exec -it container tail -f /var/log/messages

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.