From 833ef308426e836b7b1a2d5614cafeeaa6b6b475 Mon Sep 17 00:00:00 2001 From: Bagas Sanjaya Date: Wed, 22 Jan 2020 12:33:30 +0700 Subject: [PATCH 1/8] Logging Configuration - Add logrotate --- .../doc/advanced/logging-documentation.en-us.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/content/doc/advanced/logging-documentation.en-us.md b/docs/content/doc/advanced/logging-documentation.en-us.md index 73c8d5dcbc57e..cfd0213dcd3b1 100644 --- a/docs/content/doc/advanced/logging-documentation.en-us.md +++ b/docs/content/doc/advanced/logging-documentation.en-us.md @@ -388,3 +388,14 @@ func newNewoneLogService() { You should then add `newOneLogService` to `NewServices()` in `modules/setting/setting.go` + +## Using `logrotate` instead of built-in log rotation + +Gitea includes built-in log rotation mechanism, which should be enough for most deployments. However, if you instead want to use `logrotate` program instead: + +- Disable built-in log rotation by set `LOG_ROTATE` to false on your `app.ini`. +- Install `logrotate`. +- Configure `logrotate` to match your deployment requirements, see `man 8 logrotate` for configuration syntax details. In particular, use `copytruncate` option instead of restarting Gitea within `postrotate/endscript` block. Ensure that your configurations apply to all files emitted by Gitea loggers as described on above sections. +- Always do `logrotate /etc/logrotate.conf --dry-run` to test your configurations. + +The next `logrotate` jobs will include your configurations, so no restart is needed. From 0a915a3dc0e57233637fe96716b43403cf35c6c7 Mon Sep 17 00:00:00 2001 From: Bagas Sanjaya Date: Wed, 22 Jan 2020 13:19:52 +0700 Subject: [PATCH 2/8] Delete instead duplicate --- docs/content/doc/advanced/logging-documentation.en-us.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/doc/advanced/logging-documentation.en-us.md b/docs/content/doc/advanced/logging-documentation.en-us.md index cfd0213dcd3b1..f880e321693e7 100644 --- a/docs/content/doc/advanced/logging-documentation.en-us.md +++ b/docs/content/doc/advanced/logging-documentation.en-us.md @@ -391,7 +391,7 @@ You should then add `newOneLogService` to `NewServices()` in ## Using `logrotate` instead of built-in log rotation -Gitea includes built-in log rotation mechanism, which should be enough for most deployments. However, if you instead want to use `logrotate` program instead: +Gitea includes built-in log rotation mechanism, which should be enough for most deployments. However, if you instead want to use `logrotate` program: - Disable built-in log rotation by set `LOG_ROTATE` to false on your `app.ini`. - Install `logrotate`. From 1673a35819fea3f52cb2b48b16f247f39f37d94c Mon Sep 17 00:00:00 2001 From: Bagas Sanjaya Date: Thu, 23 Jan 2020 11:45:37 +0700 Subject: [PATCH 3/8] Apply suggestions from @jolheiser Co-Authored-By: John Olheiser <42128690+jolheiser@users.noreply.github.com> --- docs/content/doc/advanced/logging-documentation.en-us.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/content/doc/advanced/logging-documentation.en-us.md b/docs/content/doc/advanced/logging-documentation.en-us.md index f880e321693e7..5523a5de5a562 100644 --- a/docs/content/doc/advanced/logging-documentation.en-us.md +++ b/docs/content/doc/advanced/logging-documentation.en-us.md @@ -391,11 +391,11 @@ You should then add `newOneLogService` to `NewServices()` in ## Using `logrotate` instead of built-in log rotation -Gitea includes built-in log rotation mechanism, which should be enough for most deployments. However, if you instead want to use `logrotate` program: +Gitea includes built-in log rotation, which should be enough for most deployments. However, if you instead want to use the `logrotate` program: -- Disable built-in log rotation by set `LOG_ROTATE` to false on your `app.ini`. +- Disable built-in log rotation by setting `LOG_ROTATE` to false in your `app.ini`. - Install `logrotate`. -- Configure `logrotate` to match your deployment requirements, see `man 8 logrotate` for configuration syntax details. In particular, use `copytruncate` option instead of restarting Gitea within `postrotate/endscript` block. Ensure that your configurations apply to all files emitted by Gitea loggers as described on above sections. +- Configure `logrotate` to match your deployment requirements, see `man 8 logrotate` for configuration syntax details. In particular, use the `copytruncate` option instead of restarting Gitea within the `postrotate/endscript` block. Ensure that your configurations apply to all files emitted by Gitea loggers as described in the above sections. - Always do `logrotate /etc/logrotate.conf --dry-run` to test your configurations. The next `logrotate` jobs will include your configurations, so no restart is needed. From dd078089d11cb7ce30484aa5ef87200155411a7c Mon Sep 17 00:00:00 2001 From: Bagas Sanjaya Date: Thu, 23 Jan 2020 11:49:45 +0700 Subject: [PATCH 4/8] Quote false --- docs/content/doc/advanced/logging-documentation.en-us.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/doc/advanced/logging-documentation.en-us.md b/docs/content/doc/advanced/logging-documentation.en-us.md index 5523a5de5a562..d99ce30113aa8 100644 --- a/docs/content/doc/advanced/logging-documentation.en-us.md +++ b/docs/content/doc/advanced/logging-documentation.en-us.md @@ -393,7 +393,7 @@ You should then add `newOneLogService` to `NewServices()` in Gitea includes built-in log rotation, which should be enough for most deployments. However, if you instead want to use the `logrotate` program: -- Disable built-in log rotation by setting `LOG_ROTATE` to false in your `app.ini`. +- Disable built-in log rotation by setting `LOG_ROTATE` to `false` in your `app.ini`. - Install `logrotate`. - Configure `logrotate` to match your deployment requirements, see `man 8 logrotate` for configuration syntax details. In particular, use the `copytruncate` option instead of restarting Gitea within the `postrotate/endscript` block. Ensure that your configurations apply to all files emitted by Gitea loggers as described in the above sections. - Always do `logrotate /etc/logrotate.conf --dry-run` to test your configurations. From 8953f7529c8edecbc6396de08f0b64306b3c4614 Mon Sep 17 00:00:00 2001 From: Bagas Sanjaya Date: Thu, 23 Jan 2020 11:50:21 +0700 Subject: [PATCH 5/8] Replace program with utility --- docs/content/doc/advanced/logging-documentation.en-us.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/doc/advanced/logging-documentation.en-us.md b/docs/content/doc/advanced/logging-documentation.en-us.md index d99ce30113aa8..e61cab4c83ea4 100644 --- a/docs/content/doc/advanced/logging-documentation.en-us.md +++ b/docs/content/doc/advanced/logging-documentation.en-us.md @@ -391,7 +391,7 @@ You should then add `newOneLogService` to `NewServices()` in ## Using `logrotate` instead of built-in log rotation -Gitea includes built-in log rotation, which should be enough for most deployments. However, if you instead want to use the `logrotate` program: +Gitea includes built-in log rotation, which should be enough for most deployments. However, if you instead want to use the `logrotate` utility: - Disable built-in log rotation by setting `LOG_ROTATE` to `false` in your `app.ini`. - Install `logrotate`. From 2d5e7f0f597bb655655a42ceef1d70a7cdb6d18f Mon Sep 17 00:00:00 2001 From: Bagas Sanjaya Date: Thu, 23 Jan 2020 11:52:34 +0700 Subject: [PATCH 6/8] Whoops, use --debug switch instead --- docs/content/doc/advanced/logging-documentation.en-us.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/doc/advanced/logging-documentation.en-us.md b/docs/content/doc/advanced/logging-documentation.en-us.md index e61cab4c83ea4..95bc2a0b0817e 100644 --- a/docs/content/doc/advanced/logging-documentation.en-us.md +++ b/docs/content/doc/advanced/logging-documentation.en-us.md @@ -396,6 +396,6 @@ Gitea includes built-in log rotation, which should be enough for most deployment - Disable built-in log rotation by setting `LOG_ROTATE` to `false` in your `app.ini`. - Install `logrotate`. - Configure `logrotate` to match your deployment requirements, see `man 8 logrotate` for configuration syntax details. In particular, use the `copytruncate` option instead of restarting Gitea within the `postrotate/endscript` block. Ensure that your configurations apply to all files emitted by Gitea loggers as described in the above sections. -- Always do `logrotate /etc/logrotate.conf --dry-run` to test your configurations. +- Always do `logrotate /etc/logrotate.conf --debug` to test your configurations. The next `logrotate` jobs will include your configurations, so no restart is needed. From 49a200181d5d664dd19ebaedb055b638acc19298 Mon Sep 17 00:00:00 2001 From: Bagas Sanjaya Date: Thu, 23 Jan 2020 11:54:49 +0700 Subject: [PATCH 7/8] Optional immediate reload by --force switch --- docs/content/doc/advanced/logging-documentation.en-us.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/doc/advanced/logging-documentation.en-us.md b/docs/content/doc/advanced/logging-documentation.en-us.md index 95bc2a0b0817e..24aface60925a 100644 --- a/docs/content/doc/advanced/logging-documentation.en-us.md +++ b/docs/content/doc/advanced/logging-documentation.en-us.md @@ -398,4 +398,4 @@ Gitea includes built-in log rotation, which should be enough for most deployment - Configure `logrotate` to match your deployment requirements, see `man 8 logrotate` for configuration syntax details. In particular, use the `copytruncate` option instead of restarting Gitea within the `postrotate/endscript` block. Ensure that your configurations apply to all files emitted by Gitea loggers as described in the above sections. - Always do `logrotate /etc/logrotate.conf --debug` to test your configurations. -The next `logrotate` jobs will include your configurations, so no restart is needed. +The next `logrotate` jobs will include your configurations, so no restart is needed. You can also immediately reload `logrotate` with `logrotate /etc/logrotate.conf --force`. From 5a7bcd062af5069b5d7978f0d45eeea78292d93e Mon Sep 17 00:00:00 2001 From: zeripath Date: Mon, 13 Jul 2020 09:56:25 +0100 Subject: [PATCH 8/8] Update docs/content/doc/advanced/logging-documentation.en-us.md --- docs/content/doc/advanced/logging-documentation.en-us.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/doc/advanced/logging-documentation.en-us.md b/docs/content/doc/advanced/logging-documentation.en-us.md index 74b03dc661a99..0b3b018fabe1e 100644 --- a/docs/content/doc/advanced/logging-documentation.en-us.md +++ b/docs/content/doc/advanced/logging-documentation.en-us.md @@ -428,7 +428,7 @@ Gitea includes built-in log rotation, which should be enough for most deployment - Disable built-in log rotation by setting `LOG_ROTATE` to `false` in your `app.ini`. - Install `logrotate`. -- Configure `logrotate` to match your deployment requirements, see `man 8 logrotate` for configuration syntax details. In particular, use the `copytruncate` option instead of restarting Gitea within the `postrotate/endscript` block. Ensure that your configurations apply to all files emitted by Gitea loggers as described in the above sections. +- Configure `logrotate` to match your deployment requirements, see `man 8 logrotate` for configuration syntax details. In the `postrotate/endscript` block send Gitea a `USR1` signal via `kill -USR1` or `kill -10`, or run `gitea manager logging release-and-reopen` (with the appropriate environment). Ensure that your configurations apply to all files emitted by Gitea loggers as described in the above sections. - Always do `logrotate /etc/logrotate.conf --debug` to test your configurations. The next `logrotate` jobs will include your configurations, so no restart is needed. You can also immediately reload `logrotate` with `logrotate /etc/logrotate.conf --force`.