diff --git a/README.md b/README.md index 3cadbf3..10784c2 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,7 @@ Here is a deeper insight into the variables of this gitea role. For the exact fu | `gitea_db_password` | `lel` | Database password. **PLEASE CHANGE** | | `gitea_db_ssl` | `disable` | Configure SSL only if your database type supports it. Have a look into the [config-cheat-sheet](https://docs.gitea.io/en-us/config-cheat-sheet/#database-database) for more detailed information | | `gitea_db_path` | `{{ gitea_home }}/data/gitea.db` | DB path, if you use `sqlite3`. | +| `gitea_db_log_sql` | `false` | Log the executed SQL. | | `gitea_database_extra_config` | `''` | you can use this variable to pass additional config parameters in the `[database]` section of the config. | ### Indexer ([indexer](https://docs.gitea.io/en-us/config-cheat-sheet/#indexer-indexer)) @@ -190,6 +191,12 @@ Here is a deeper insight into the variables of this gitea role. For the exact fu | `attachment_enabled` | `true` | Whether issue and pull request attachments are enabled. | | `gitea_attachment_extra_config` | `''` | you can use this variable to pass additional config parameters in the `[attachment]` section of the config. | +### Log ([log](https://docs.gitea.io/en-us/config-cheat-sheet/#log-log)) +| variable name | default value | description | +| ------------- | ------------- | ----------- | +| `gitea_log_systemd` | `false` | Disable logging into `file`, use systemd-journald | +| `gitea_log_level` | `Warn` | General log level. `[Trace, Debug, Info, Warn, Error, Critical, Fatal, None]` | +| `gitea_log_extra_config` | `''` | you can use this variable to pass additional config parameters in the `[log]` section of the config. | @@ -223,8 +230,6 @@ Here is a deeper insight into the variables of this gitea role. For the exact fu ### 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 diff --git a/defaults/main.yml b/defaults/main.yml index 3001339..93e0be3 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -59,6 +59,7 @@ gitea_db_user: 'gitea' gitea_db_password: 'lel' gitea_db_ssl: 'disable' gitea_db_path: "{{ gitea_home }}/data/gitea.db" +gitea_db_log_sql: false gitea_database_extra_config: '' # Indexer (indexer) @@ -114,7 +115,12 @@ gitea_picture_extra_config: '' # Issue and pull request attachments (attachment) gitea_attachment_enabled: true -gitea_picture_extra_config: '' +gitea_attachment_extra_config: '' + +# Log (log) +gitea_log_systemd: false +gitea_log_level: 'Warn' +gitea_log_extra_config: '' # security gitea_lfs_jwt_secret: '' @@ -123,9 +129,6 @@ gitea_oauth2_jwt_secret: '' gitea_systemd_cap_net_bind_service: false -gitea_log_systemd: false -gitea_log_only_warning: true - gitea_fail2ban_enabled: false gitea_fail2ban_jail_maxretry: 10 gitea_fail2ban_jail_findtime: 3600 @@ -137,8 +140,6 @@ gitea_oauth2_enabled: true gitea_metrics_enabled: false gitea_metrics_token: ~ -gitea_log_level: Info - gitea_extra_config: "" gitea_backup_on_upgrade: false diff --git a/templates/gitea.ini.j2 b/templates/gitea.ini.j2 index d45d6dd..082f70e 100644 --- a/templates/gitea.ini.j2 +++ b/templates/gitea.ini.j2 @@ -67,9 +67,7 @@ USER = {{ gitea_db_user }} PASSWD = {{ gitea_db_password }} SSL_MODE = {{ gitea_db_ssl }} PATH = {{ gitea_db_path }} -{% if gitea_log_only_warning %} -LOG_SQL = false -{% endif %} +LOG_SQL = {{ gitea_db_log_sql | ternary('true', 'false') }} {{ gitea_database_extra_config }} ; ; @@ -144,28 +142,19 @@ PATH = {{ gitea_home }}/data/attachments {{ gitea_attachment_extra_config }} ; ; -; +; -> https://docs.gitea.io/en-us/config-cheat-sheet/#log-log [log] 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 -MACARON = 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 %} - +LEVEL = {{ gitea_log_level }} +{{ gitea_log_extra_config }} +; +; +; [oauth2] ENABLE = {{ gitea_oauth2_enabled }} JWT_SECRET = {{ gitea_oauth2_jwt_secret }}