How to delete logs from Gitlab Docker instance (Omnibus)

You can often save multiple gigabytes of space by deleting old logs from Gitlab instances. It should be clear that the logs will be lost forever once deleting them, so ensure that you don’t really care about your content before deleting this.

First, enter the logs directory, that is the directory mapped to /var/log/gitlab. This should be mapped out from your container to a local directory or volume. In our Gitlab reference config for docker-compose, we have mapped it to the logs directory.

In that directory, run the following commands:

find . \( -name "*.gz" -o -name "*.log* -o -name "*.s" -o -name "*.u" \) -exec rm -v {} \;

This will delete all files with the given extensions.