Skip to content

add component based log level config for icingadb - #369

Open
fscaptain wants to merge 2 commits into
NETWAYS:mainfrom
fscaptain:icingadb-component-loglevel-config
Open

add component based log level config for icingadb#369
fscaptain wants to merge 2 commits into
NETWAYS:mainfrom
fscaptain:icingadb-component-loglevel-config

Conversation

@fscaptain

Copy link
Copy Markdown

Make it possible to define component based log levels for icingadb.

@cla-bot cla-bot Bot added the cla/signed label Apr 9, 2025
@martialblog
martialblog requested a review from Donien July 30, 2026 05:57
@Donien

Donien commented Jul 30, 2026

Copy link
Copy Markdown
Member

Hi @fscaptain,

sorry for letting you wait.

This looks good to me. Though, we could improve on it a little in the future (testing for valid values would not be necessary if we used argument specs, that's for the future though).

Could you rebase your branch on the current main?

I've already prepared a patch for your branch if you'd like to use that :)

diff --git a/doc/role-icingadb/README.md b/doc/role-icingadb/README.md
new file mode 120000
index 0000000..239b853
--- /dev/null
+++ b/doc/role-icingadb/README.md
@@ -0,0 +1 @@
+../../roles/icingadb/README.md
\ No newline at end of file
diff --git a/doc/role-icingadb/role-icingadb.md b/roles/icingadb/README.md
similarity index 69%
rename from doc/role-icingadb/role-icingadb.md
rename to roles/icingadb/README.md
index 8b2f4ec..6641670 100644
--- a/doc/role-icingadb/role-icingadb.md
+++ b/roles/icingadb/README.md
@@ -1,4 +1,4 @@
-# Role icinga.icinga.icingadb
+# Role netways.icinga.icingadb
 
 This role installs and configures the IcingaDB daemon. In addition it can also import the schema into the database. It is idempotent and works in HA-setups (two Icinga2 instances).
 
@@ -6,15 +6,15 @@ It serves as the official, more performant successor to Icinga IDO. More informa
 
 
 > [!TIP]
-> In many scenarios you want to install the [icingadb_redis role](../role-icingadb_redis/) together with this role. It is part of this collection, too.
+> In many scenarios you want to install the [icingadb_redis role](https://github.com/NETWAYS/ansible-collection-icinga/tree/main/doc/role-icingadb_redis/) together with this role. It is part of this collection, too.
 
 ## Database
 
-IcingaDB relies on a relational database to persist received data. This database **won't** be created by this role - you need to deploy and configure one in advance. For more information, see the [Databases](../getting-started.md#databases) section in the getting started guide.
+IcingaDB relies on a relational database to persist received data. This database **won't** be created by this role - you need to deploy and configure one in advance. For more information, see the [Databases](https://github.com/NETWAYS/ansible-collection-icinga/tree/main/doc/getting-started.md) section in the getting started guide.
 
 ## Variables
 
-The following variables define the configuration for IcingaDB. Some variables got predefined [defaults](../../roles/icingadb/defaults/main.yml), others are purely opt-in.
+The following variables define the configuration for IcingaDB. Some variables got predefined [defaults](https://github.com/NETWAYS/ansible-collection-icinga/tree/main/roles/icingadb/defaults/main.yml), others are purely opt-in.
 
 For more information on the respective settings please see [the official documentation](https://icinga.com/docs/icinga-db/latest/doc/03-Configuration/).
 
@@ -51,26 +51,26 @@ For more information on the respective settings please see [the official documen
 
 ### Logging configuration
 
-| Variable | Type | Description | Default |
-|----------|------|-------------|---------|
-| `icingadb_logging_level` | `fatal\|error\|warn\|info\|debug` | Defines the logging level for IcingaDB. | `info` |
+| Variable                 | Type      | Description                             | Default |
+|----------                |------     |-------------                            |---------|
+| `icingadb_logging_level` | `fatal\|error\|warn\|info\|debug` | Defines the logging level for IcingaDB. | `info`  |
 
 #### Compont based log level
 The following variables can be used to define special log levels for individual components.
 
-| Variable | Type | Description | Default |
-|----------|------|-------------|---------|
-| `icingadb_log_level_confic_sync` | `fatal\|error\|warn\|info\|debug` | log-level for component `config-sync`  | value from `icingadb_logging_level`, `info` by default   |
-| `icingadb_log_level_database` | `fatal\|error\|warn\|info\|debug` | log-level for component `database`  | value from `icingadb_logging_level`, `info` by default   |
-| `icingadb_log_level_dumps_ignals` | `fatal\|error\|warn\|info\|debug` | log-level for component `dump-signals`  | value from `icingadb_logging_level`, `info` by default   |
-| `icingadb_log_level_confic_sync` | `fatal\|error\|warn\|info\|debug` | log-level for component `heartbeat`  | value from `icingadb_logging_level`, `info` by default   |
-| `icingadb_log_level_high_availability` | `fatal\|error\|warn\|info\|debug` | log-level for component `high-availability`  | value from `icingadb_logging_level`, `info` by default   |
-| `icingadb_log_level_history_sync` | `fatal\|error\|warn\|info\|debug` | log-level for component `history-sync`  | value from `icingadb_logging_level`, `info` by default   |
-| `icingadb_log_level_overdue_sync` | `fatal\|error\|warn\|info\|debug` | log-level for component `overdue-sync`  | value from `icingadb_logging_level`, `info` by default   |
-| `icingadb_log_level_redis` | `fatal\|error\|warn\|info\|debug` | log-level for component `redis`  | value from `icingadb_logging_level`, `info` by default   |
-| `icingadb_log_level_retention` | `fatal\|error\|warn\|info\|debug` | log-level for component `retention`  | value from `icingadb_logging_level`, `info` by default   |
-| `icingadb_log_level_runtime_updates` | `fatal\|error\|warn\|info\|debug` | log-level for component `runtime-updates`  | value from `icingadb_logging_level`, `info` by default   |
-| `icingadb_log_level_telemetry` | `fatal\|error\|warn\|info\|debug` | log-level for component `telemetry`  | value from `icingadb_logging_level`, `info` by default   |
+| Variable                               | Type                              | Description                                 | Default                                                |
+| ---                                    | ---                               | ---                                         | ---                                                    |
+| `icingadb_log_level_confic_sync`       | `fatal\|error\|warn\|info\|debug` | log-level for component `config-sync`       | value from `icingadb_logging_level`, `info` by default |
+| `icingadb_log_level_database`          | `fatal\|error\|warn\|info\|debug` | log-level for component `database`          | value from `icingadb_logging_level`, `info` by default |
+| `icingadb_log_level_dumps_ignals`      | `fatal\|error\|warn\|info\|debug` | log-level for component `dump-signals`      | value from `icingadb_logging_level`, `info` by default |
+| `icingadb_log_level_confic_sync`       | `fatal\|error\|warn\|info\|debug` | log-level for component `heartbeat`         | value from `icingadb_logging_level`, `info` by default |
+| `icingadb_log_level_high_availability` | `fatal\|error\|warn\|info\|debug` | log-level for component `high-availability` | value from `icingadb_logging_level`, `info` by default |
+| `icingadb_log_level_history_sync`      | `fatal\|error\|warn\|info\|debug` | log-level for component `history-sync`      | value from `icingadb_logging_level`, `info` by default |
+| `icingadb_log_level_overdue_sync`      | `fatal\|error\|warn\|info\|debug` | log-level for component `overdue-sync`      | value from `icingadb_logging_level`, `info` by default |
+| `icingadb_log_level_redis`             | `fatal\|error\|warn\|info\|debug` | log-level for component `redis`             | value from `icingadb_logging_level`, `info` by default |
+| `icingadb_log_level_retention`         | `fatal\|error\|warn\|info\|debug` | log-level for component `retention`         | value from `icingadb_logging_level`, `info` by default |
+| `icingadb_log_level_runtime_updates`   | `fatal\|error\|warn\|info\|debug` | log-level for component `runtime-updates`   | value from `icingadb_logging_level`, `info` by default |
+| `icingadb_log_level_telemetry`         | `fatal\|error\|warn\|info\|debug` | log-level for component `telemetry`         | value from `icingadb_logging_level`, `info` by default |
 
 ### IcingaDB Retention
 
@@ -114,7 +114,7 @@ This play installs IcingaDB with on the same host as its connected MysQL databas
     icingadb_database_type: mysql  # needed by the schema import
 
   roles:
-    - role: icinga.icinga.icingadb
+    - role: netways.icinga.icingadb
 ```
 
 This more complex example installs IcingaDB and connects it to a **remote** PostgreSQL database, using client certificates and TLS. It also imports the schema into the database. Redis is installed locally.
@@ -135,5 +135,5 @@ This more complex example installs IcingaDB and connects it to a **remote** Post
     icingadb_database_import_schema: true
 
   roles:
-    - role: icinga.icinga.icingadb
+    - role: netways.icinga.icingadb
 ```
diff --git a/roles/icingadb/templates/icingadb.ini.j2 b/roles/icingadb/templates/icingadb.ini.j2
index 939f90c..f2cb408 100644
--- a/roles/icingadb/templates/icingadb.ini.j2
+++ b/roles/icingadb/templates/icingadb.ini.j2
@@ -30,7 +30,9 @@ database:
 
 redis:
   host: {{ icingadb_redis_host }}
-{% if icingadb_redis_port is defined %}
+{% if icingadb_redis_tls is defined %}
+  port: {{ icingadb_redis_tls_port | default(icingadb_redis_port) }}
+{% else %}
   port: {{ icingadb_redis_port }}
 {% endif %}
 {% if icingadb_redis_password is defined %}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants