Skip to content

Add backup/restore output logs

Problem to solve

Currently, all backup/restore operations (sudo gitlab-backup create and sudo gitlab-backup restore) output to STDOUT, which is fine, but I think we should also log this output to a log file, under /var/log/gitlab/backups/<TIMESTAMP>.log and /var/log/gitlab/restore/<TIMESTAMP>.log respectively.

There are times where these logs would come in handy especially for GitLab Support when we assist customers (and also sys admins as well), especially when debugging for issues with these operations:

  • If a backup takes a long time, sometimes the SSH connection might time out, which terminates the process. This would become more obvious if the output was in a log file. The alternative currently is using screen or tmux to run the backup so that the process isn't terminated.
  • The SSH client being used by the user might not have a big enough buffer, so if the backup is rather large and takes a long time, a consequence is that the logs will be long as well and the start of the logs in the STDOUT are lost (probably more so for the restore)

Yes, there are workarounds in these situations, but if we have a log for reconfigures, why not backups and restores?

Intended users

Further details

The goal here is to make it easier to gather backup/restore logs for the purposes of debugging issues.

The side effect of this is that it creates a backup/restore history - which isn't necessarily a bad thing.

Proposal

See problem to solve.

Permissions and Security

Documentation

The docs in https://docs.gitlab.com/ee/raketasks/backup_restore.html and https://docs.gitlab.com/ee/administration/logs.html will need to be updated.

Testing

I suspect this change is really low risk, as we just want to copy STDOUT and put it in a log file.

What does success look like, and how can we measure that?

Having log files!

What is the type of buyer?

Should be in FOSS and up.

Links / references