I’ve been using LXC since few years ago. When I started to use it, I always configured the host’s rsyslog, that it created a /dev/log socket in /var/lib/lxc/NAME/rootfs.dev/, and reads it. Then I could catch all messages from all containers.
In the newest systems, there isn’t rootfs.dev - is there any way to make some similar solution like above?
The host and “guests” systems are Debian, with systemd.
I could done that configured systemd that reads the /dev/log inside of container, and sends to rsyslog through tcp… but not all messages arrived, eg. when I restart a service (eg. ssh), it doesn’t showed in host log.
This is an LXC question so I am not very familiar.
With LXD you can create socket devices and you have quite a few options.
Having said that, I think it would be more portable if you get rsyslog on the host to listen to TCP on its IP address of the lxcbr0 interface (like 10.10.10.1). Then configure each container to send syslog events to the IP address 10.10.10.1.
Here is the part in /etc/rsyslog.conf on the host to enable the reception of events,
But what do you think about, how can I configure the containers to send the syslog to host?
Now I installed the “traditional” syslogd, configured the . to @host-system.
But my real question is there any other solution? I mean, should I bypass the syslogd, and configure the systemd-syslog that it send the messages to remote?
That’s it, now I got all service messages in host syslog (eg. ssh restart, mysql restart), but if I send a message from console (eg. “logger foobar”), that’s also will be logged.
You can read the guest system’s syslog from the host system through the guests /dev/kmesg? And are your container root FS mount, and you access to the /proc?
That’s my problem, I can’t access to the root FS of LXC, nor /proc of LXC.