LoginSignup
16
16

More than 5 years have passed since last update.

GitLab Omnibusをインストールしたときのログローテーション(CentOS6.5)

Posted at

CentOS6.xにGitlab Omnibusをインストールする方法は、ほぼ公式の通りですし、

あたりに注意点含めて書いてあるのでそちらをどうぞ。

ちなみに自分がいれたのは、gitlab-6.8.2_omnibus-1.el6.x86_64.rpm。

インストールはまぁ、問題なく終わってすぐGitLabが使えるようになると思います。
バックアップの方法も公式ドキュメントの通りでできます。

しかし、/etc/logrotate.d ディレクトリなんか見てもログローテーションの設定がないです。
ちなみに、ログは /var/log/gitlab 配下にいくつかディレクトリあってそこに出力されています。

nginxやpostgresqlをはじめ、各サービスはrunitでデーモン化されて、標準出力はsvlogdでログに出力されているので、それでローテーションされるので問題ないですね。

それでも rails のログや、nginxのアクセスログはローテーションする設定がないので、その設定はしてやる必要があるようです。

自分は以下のようにしました。

railsのログ

/etc/logrotate.d/gitlab ファイルを以下の内容で作成。これは、https://github.com/gitlabhq/gitlabhq/blob/master/lib/support/logrotate/gitlab より拝借。

/var/log/gitlab/gitlab-rails/*.log {
    daily
    missingok
    rotate 40
    compress
    notifempty
    copytruncate
}

/var/log/gitlab/gitlab-shell/gitlab-shell.log {
    daily
    missingok
    rotate 40
    compress
    notifempty
    copytruncate
}

nginxのログ

nginxのプロセスにUSR1シグナルを送る感じになるので、svコマンドから送るようにしました。
/etc/logrotate.d/nginx を以下の内容で作成した。

/var/log/gitlab/nginx/*.log {
    missingok
    notifempty
    sharedscripts
    postrotate
       /opt/gitlab/embedded/bin/sv 1 /opt/gitlab/service/nginx
    endscript
}

別件。PostgreSQLへのアクセス

ちなみに、GitLab Omnibus では PostgreSQL がインストールされてしまうわけですが、これにアクセスするには以下のコマンドを使うとよいです。

$ /opt/gitlab/embedded/bin/psql -h localhost -U gitlab -d gitlabhq_production

という感じで、GitLab をうまく運用できるのではないでしょうか。。。

16
16
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
16