how to check syslog for ubuntu docker

Nilesh picture Nilesh · Jun 20, 2016 · Viewed 9.2k times · Source

I installed tutum/ubuntu in local vm's docker.

When I login to ubuntu and run below command.

logger "Test Logging"

I can't find the file where this logged in. In my local system I can see the system.log or syslog or messages file in /var/log. But when I check /var/log in container, I can't find any file like this.

root@fbc4ae457ad9:~# ls -al /var/log/
total 316
drwxrwxr-x  6 root syslog   4096 Jun 20 16:49 .
drwxr-xr-x 16 root root     4096 Jun 20 16:42 ..
-rw-r--r--  1 root root     9174 Mar 17 15:17 alternatives.log
drwxr-xr-x  2 root root     4096 Mar 17 15:17 apt
-rw-r--r--  1 root root    47816 Mar 15 04:34 bootstrap.log
-rw-rw----  1 root utmp      768 Jun 20 16:49 btmp
-rw-r-----  1 root adm        31 Mar 15 04:34 dmesg
-rw-r--r--  1 root root   213169 Mar 17 15:17 dpkg.log
-rw-r--r--  1 root root     3296 Mar 17 15:17 faillog
drwxr-xr-x  2 root root     4096 Mar 15 04:34 fsck
-rw-rw-r--  1 root utmp    30076 Jun 20 16:53 lastlog
drwxr-xr-x  2 root root     4096 Apr 11  2014 upstart
-rw-rw-r--  1 root utmp     1920 Jun 20 16:53 wtmp

I check in upstart and other directory, but all are empty.

Which file I have to check for systemlog ?

Answer

seven picture seven · Feb 15, 2017

There is no rsyslogd installed by default, nor in this image you are using.

If you wish to utilize rsyslogd in your docker container, you should install/configure it by your self via Dockerfile first.

RUN apt-get -y install rsyslog

You will probably need supervisord as well to have all your processes started in container.