Truncating log files

Depending on your settings, OpenStack Dashboard produces lots of log output. Fortunately there is already a tool in place, which cleans them up for you. Looking at /var/log/httpd/ you'll probably notice files like access_log-(date).gz. They were generated by logrotate by compressing existent logs.

To use the same mechanism for OpenStack Dashboard, create a file /etc/logrotate.d/openstack-dashboard:

/var/log/horizon/*.log {
    weekly
    rotate 4
    missingok
    delaycompress
    postrotate
        /bin/systemctl reload httpd.service > /dev/null 2>/dev/null || true
    endscript
}

Make sure, your file has perms 644: chmod 644 /etc/logrotate.d/openstack-dashboard. To test, if it works, issue logrotate -d /etc/logrotate.conf and watch its output closely.

You should find lines like:

reading config file openstack-ceilometer
reading config file openstack-cinder
reading config file openstack-dashboard
reading config file openstack-glance
reading config file openstack-heat

and a bit further down:

rotating pattern: /var/log/horizon/*.log  weekly (4 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/horizon/horizon.log
  log does not need rotating