diff --git a/Changelog.md b/Changelog.md
index 057df31..5d35291 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -1,9 +1,11 @@
## 0.9.16 (next version, not yet released)
* `docker exec` is now the default and recommended mechanism for running commands in the container. SSH is now disabled by default, but is still supported for those cases where "docker exec" is not appropriate. Closes GH-168.
+ * All syslog output is now forwarded to `docker logs`. Closes GH-123.
* The workaround for Docker bug 2267 (the inability to modify /etc/hosts) has been removed, because it has been fixed upstream. Closes GH-155.
* Logrotate now reloads syslog-ng properly. Closes GH-167.
* Fixed some locale issues. Closes GH-178. Thanks to David J. M. Karlsen.
+ * Fixed problems with cron. Closes GH-115.
## 0.9.15 (release date: 2014-10-03)
diff --git a/README.md b/README.md
index f497ab9..2cd3b1b 100644
--- a/README.md
+++ b/README.md
@@ -82,7 +82,7 @@ You can configure the stock `ubuntu` image yourself from your Dockerfile, so why
| Ubuntu 14.04 LTS | The base system. |
| A **correct** init process | According to the Unix process model, [the init process](https://en.wikipedia.org/wiki/Init) -- PID 1 -- inherits all [orphaned child processes](https://en.wikipedia.org/wiki/Orphan_process) and must [reap them](https://en.wikipedia.org/wiki/Wait_(system_call)). Most Docker containers do not have an init process that does this correctly, and as a result their containers become filled with [zombie processes](https://en.wikipedia.org/wiki/Zombie_process) over time.
Furthermore, `docker stop` sends SIGTERM to the init process, which is then supposed to stop all services. Unfortunately most init systems don't do this correctly within Docker since they're built for hardware shutdowns instead. This causes processes to be hard killed with SIGKILL, which doesn't give them a chance to correctly deinitialize things. This can cause file corruption.
Baseimage-docker comes with an init process `/sbin/my_init` that performs both of these tasks correctly. |
| Fixes APT incompatibilities with Docker | See https://github.com/dotcloud/docker/issues/1024. |
-| syslog-ng | A syslog daemon is necessary so that many services - including the kernel itself - can correctly log to /var/log/syslog. If no syslog daemon is running, a lot of important messages are silently swallowed.
Only listens locally. |
+| syslog-ng | A syslog daemon is necessary so that many services - including the kernel itself - can correctly log to /var/log/syslog. If no syslog daemon is running, a lot of important messages are silently swallowed.
Only listens locally. All syslog messages are forwarded to "docker logs". |
| logrotate | Rotates and compresses logs on a regular basis. |
| SSH server | Allows you to easily login to your container to [inspect or administer](#login_ssh) things.
_SSH is **disabled by default** and is only one of the methods provided by baseimage-docker for this purpose. The other method is through [docker exec](#login_docker_exec). SSH is also provided as an alternative because `docker exec` comes with several caveats._
Password and challenge-response authentication are disabled by default. Only key authentication is allowed. |
| cron | The cron daemon must be running for cron jobs to work. |
diff --git a/image/config/logrotate_syslogng b/image/config/logrotate_syslogng
new file mode 100644
index 0000000..b56ffc3
--- /dev/null
+++ b/image/config/logrotate_syslogng
@@ -0,0 +1,38 @@
+/var/log/syslog
+{
+ rotate 7
+ daily
+ missingok
+ notifempty
+ delaycompress
+ compress
+ postrotate
+ sv reload syslog-ng > /dev/null
+ endscript
+}
+
+/var/log/mail.info
+/var/log/mail.warn
+/var/log/mail.err
+/var/log/mail.log
+/var/log/daemon.log
+/var/log/kern.log
+/var/log/auth.log
+/var/log/user.log
+/var/log/lpr.log
+/var/log/cron.log
+/var/log/debug
+/var/log/messages
+{
+ rotate 4
+ weekly
+ missingok
+ notifempty
+ compress
+ delaycompress
+ sharedscripts
+ postrotate
+ sv reload syslog-ng > /dev/null
+ sv restart cron-log-forwarder > /dev/null
+ endscript
+}
diff --git a/image/prepare.sh b/image/prepare.sh
index 8166fa5..3c2baac 100755
--- a/image/prepare.sh
+++ b/image/prepare.sh
@@ -45,3 +45,5 @@ apt-get dist-upgrade -y --no-install-recommends
$minimal_apt_get_install language-pack-en
locale-gen en_US
update-locale LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8
+echo -n en_US.UTF-8 > /etc/container_environment/LANG
+echo -n en_US.UTF-8 > /etc/container_environment/LC_CTYPE
diff --git a/image/runit/syslog-forwarder b/image/runit/syslog-forwarder
new file mode 100755
index 0000000..2a20072
--- /dev/null
+++ b/image/runit/syslog-forwarder
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec tail -f -n 0 /var/log/syslog
diff --git a/image/system_services.sh b/image/system_services.sh
index b9699c1..56c65bb 100755
--- a/image/system_services.sh
+++ b/image/system_services.sh
@@ -25,13 +25,19 @@ mkdir /etc/service/syslog-ng
cp /build/runit/syslog-ng /etc/service/syslog-ng/run
mkdir -p /var/lib/syslog-ng
cp /build/config/syslog_ng_default /etc/default/syslog-ng
+touch /var/log/syslog
+chmod u=rw,g=r,o= /var/log/syslog
# Replace the system() source because inside Docker we
# can't access /proc/kmsg.
sed -i -E 's/^(\s*)system\(\);/\1unix-stream("\/dev\/log");/' /etc/syslog-ng/syslog-ng.conf
+## Install syslog to "docker logs" forwarder.
+mkdir /etc/service/syslog-forwarder
+cp /build/runit/syslog-forwarder /etc/service/syslog-forwarder/run
+
## Install logrotate.
$minimal_apt_get_install logrotate
-sed -i 's|invoke-rc.d syslog-ng reload|sv reload syslog-ng|g' /etc/logrotate.d/syslog-ng
+cp /build/config/logrotate_syslogng /etc/logrotate.d/syslog-ng
## Install the SSH server.
$minimal_apt_get_install openssh-server
@@ -55,6 +61,7 @@ cp /build/bin/enable_insecure_key /usr/sbin/
## Install cron daemon.
$minimal_apt_get_install cron
mkdir /etc/service/cron
+chmod 600 /etc/crontab
cp /build/runit/cron /etc/service/cron/run
## Remove useless cron entries.