diff --git a/README.md b/README.md index e8db3ff..ef2848e 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,10 @@ The following code has been tested with Debian 8, it should work on Ubuntu as we * `gitea_mailer_from`: Sender mail address * `gitea_enable_notify_mail`: Whether e-mail should be send to watchers of a repository when something happens. Default: `false` +### Log configuration +* `gitea_log_systemd` Disable logging into `file`, use systemd-journald +* `gitea_log_only_warning` Log only warnings or above, no http access or sql logging (Default: `true`) + ### Fail2Ban configuration If enabled, this will deploy a fail2ban filter and jail config for Gitea as described in the [Gitea Documentation](https://docs.gitea.io/en-us/fail2ban-setup/). diff --git a/defaults/main.yml b/defaults/main.yml index cefc8e5..bc1af1b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -60,6 +60,9 @@ gitea_mailer_user: "" gitea_mailer_password: "" gitea_mailer_type: smtp +gitea_log_systemd: false +gitea_log_only_warning: true + gitea_fail2ban_enabled: false gitea_fail2ban_jail_maxretry: 10 gitea_fail2ban_jail_findtime: 3600 diff --git a/templates/gitea.ini.j2 b/templates/gitea.ini.j2 index 552ca0b..ec66b04 100644 --- a/templates/gitea.ini.j2 +++ b/templates/gitea.ini.j2 @@ -186,12 +186,21 @@ PATH = {{ gitea_home }}/data/attachments ROOT_PATH = {{ gitea_home }}/log ; Either "console", "file", "conn", "smtp" or "database", default is "console" ; Use comma to separate multiple modes, e.g. "console, file" +{% if gitea_log_systemd %} +MODE = console +{% else %} MODE = file +{% endif %} ; Buffer length of the channel, keep it as it is if you don't know what it is. BUFFER_LEN = 10000 ; Either "Trace", "Debug", "Info", "Warn", "Error", "Critical", default is "Trace" +{% if gitea_log_only_warning %} +LEVEL = Warn +REDIRECT_MACARON_LOG = true +{% else %} LEVEL = Info REDIRECT_MACARON_LOG = false +{% endif %} [oauth2] ENABLE = {{ gitea_oauth2_enabled }}