# Does the Docker installation still rotate logs?

**URL:** <https://meta.discourse.org/t/does-the-docker-installation-still-rotate-logs/62841>\
**Category:** Product Support\
**Created:** [May 17, 2017, 1:10am UTC](https://meta.discourse.org/t/does-the-docker-installation-still-rotate-logs/62841 "2017-05-17T01:10:21Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [May 17, 2017, 2:09pm UTC](https://meta.discourse.org/t/does-the-docker-installation-still-rotate-logs/62841/7 "2017-05-17T14:09:26Z")

</div>

I just checked a recent install and can confirm we are indeed rotating.

The log rotations depends on a few things:

### First and foremost, being on a recent image.

This is how you can find what you are on:

```plaintext
cd /var/discourse
git pull
nano launcher

```

Look for this line in launcher [discourse\_docker/launcher at master · discourse/discourse\_docker · GitHub](https://github.com/discourse/discourse_docker/blob/master/launcher#L67)

eg:

```plaintext
image=discourse/discourse:1.3.10

```

Then compare to the image you are running:

```plaintext
./launcher enter app
cat /VERSION
1.3.10

```

If you are an old image, **do this ASAP** :

```plaintext
cd /var/discourse
./launcher rebuild app

```

### Make sure you have /var/log mounted to host

Our [sample template](https://github.com/discourse/discourse_docker/blob/master/samples/standalone.yml) contains the lines:

```plaintext
volumes:
  - volume:
      host: /var/discourse/shared/standalone
      guest: /shared
  - volume:
      host: /var/discourse/shared/standalone/log/var-log
      guest: /var/log

```

This says that `/var/log` in the container will be mounted at `/var/discourse/shared/standalone/log/var-log`

If this is missing, **add it asap** we expect the logs to live outside of the container, not inside it.

### How our log rotation is configured?

Our web template [contains this info](https://github.com/discourse/discourse_docker/blob/master/templates/web.template.yml#L228-L243)

```plaintext
  - file:
     path: /etc/logrotate.d/nginx
     contents: |
        /var/log/nginx/*.log {
          daily
          missingok
          rotate 14
          compress
          delaycompress
          notifempty
          create 0640 www-data www-data
          sharedscripts
          postrotate
            sv 1 nginx
          endscript

```

Once a day we rotate logs for NGINX and compress old logs.

The image runs `cron` (actually anacron on boot and then cron which is a bit better)

```plaintext
./launcher enter app
ps aux | grep cron

root 48 0.0 0.0 4244 764 ? Ss May04 0:00 runsv cron
root 51 0.0 0.0 29300 2956 ? S May04 0:01 cron -f

```

cron runs logrotate daily in `/etc/cron.daily`

```plaintext
cat /var/log/syslog.1
May 17 07:30:01 server anacron[13014]: Will run job `cron.daily' in 5 min.
May 17 07:35:01 server anacron[13014]: Job `cron.daily' started
May 17 07:35:01 server anacron[13359]: Updated timestamp for job `cron.daily' to 2017-05-17
May 17 07:52:41 server anacron[13014]: Job `cron.daily' terminated

```

* * *

So yeah, this is all working but you may need a rebuild and you may need to add the missing share.

---

_[View the full topic](https://meta.discourse.org/t/does-the-docker-installation-still-rotate-logs/62841)._
