Skip to content

Reconfigure log creates new file on each run, causing proliferation of log files

Description:

Each time gitlab-omnibus reconfigure runs, a new log file is created with the format <unix_timestamp>.log. If there’s a configuration error and the container restarts reconfigure repeatedly, /var/log/gitlab/reconfigure/ quickly fills with many files.

Steps to reproduce:

  1. Start a GitLab Omnibus container.
  2. Introduce a misconfiguration in gitlab.rb.
  3. Run gitlab-omnibus reconfigure or wait for an automatic container restart.
  4. Check /var/log/gitlab/reconfigure/ — a new file appears with each run.

Observed behavior:

  • reconfigure logs are always written to a new file based on the UNIX timestamp.
  • Repeated restarts generate multiple log files.

Expected behavior:

  • Option to write all reconfigure logs to a single file, or to parameterize the log filename.
  • Current behavior creates noise for systems with log parsers due to many small log files, making diagnostics harder.

Affected file (Omnibus source):

files/gitlab-cookbooks/solo.rb

TIME = Time.now.to_i
LOG_PATH = '/var/log/gitlab/reconfigure'.freeze
Dir.exist?(LOG_PATH) || FileUtils.mkdir_p(LOG_PATH)
...
log_location "#{LOG_PATH}/#{TIME}.log"

Proposed solution:

  • Make the log filename configurable via an environment variable or startup option.
  • This allows GitLab to choose the appropriate behavior without breaking existing mechanisms.

Additional context:

  • Problem occurs during automatic container restarts.
  • Many small log files increase noise in systems with automated log parsing.
Edited by Michael Kazakov