diff --git a/REFERENCE.md b/REFERENCE.md
index 5b7743f..8e34071 100644
--- a/REFERENCE.md
+++ b/REFERENCE.md
@@ -112,9 +112,9 @@ Default value: `[]`
##### `logging_type`
-Data type: `Enum['file', 'syslog']`
+Data type: `Enum['file', 'syslog', 'eventlog']`
-Switch the log target. Only `file` is supported on Windows.
+Switch the log target. On Windows `syslog` is ignored, `eventlog` on all other platforms.
Default value: `'file'`
@@ -706,9 +706,9 @@ Default value: `undef`
##### `logging_type`
-Data type: `Enum['file', 'syslog']`
+Data type: `Enum['file', 'syslog', 'eventlog']`
-Switch the log target. Only `file` is supported on Windows.
+Switch the log target. On Windows `syslog` is ignored, `eventlog` on all other platforms.
Default value: `'file'`
@@ -1831,9 +1831,9 @@ Default value: `[]`
##### `logging_type`
-Data type: `Enum['file', 'syslog']`
+Data type: `Enum['file', 'syslog', 'eventlog']`
-Switch the log target. Only `file` is supported on Windows.
+Switch the log target. On Windows `syslog` is ignored, `eventlog` on all other platforms.
Default value: `'file'`
diff --git a/manifests/agent.pp b/manifests/agent.pp
index 7d3af9d..caa68a9 100644
--- a/manifests/agent.pp
+++ b/manifests/agent.pp
@@ -14,7 +14,7 @@
# List of global zones to configure.
#
# @param logging_type
-# Switch the log target. Only `file` is supported on Windows.
+# Switch the log target. On Windows `syslog` is ignored, `eventlog` on all other platforms.
#
# @param logging_level
# Set the log level.
@@ -27,14 +27,14 @@
# and add the Icinga user to this group.
#
class icinga::agent (
- Stdlib::Host $ca_server,
- Hash[String, Hash] $parent_endpoints,
- String $parent_zone = 'main',
- Array[String] $global_zones = [],
- Enum['file', 'syslog'] $logging_type = 'file',
- Optional[Icinga::LogLevel] $logging_level = undef,
- String $zone = 'NodeName',
- Boolean $run_web = false,
+ Stdlib::Host $ca_server,
+ Hash[String, Hash] $parent_endpoints,
+ String $parent_zone = 'main',
+ Array[String] $global_zones = [],
+ Enum['file', 'syslog', 'eventlog'] $logging_type = 'file',
+ Optional[Icinga::LogLevel] $logging_level = undef,
+ String $zone = 'NodeName',
+ Boolean $run_web = false,
) {
class { 'icinga':
ca => false,
diff --git a/manifests/init.pp b/manifests/init.pp
index 3f61ba1..943ff32 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -29,7 +29,7 @@
# to authenticate the certificate request againt the CA on host `ca_server`.
#
# @param logging_type
-# Switch the log target. Only `file` is supported on Windows.
+# Switch the log target. On Windows `syslog` is ignored, `eventlog` on all other platforms.
#
# @param logging_level
# Set the log level.
@@ -56,7 +56,7 @@
Optional[Stdlib::Host] $ca_server = undef,
Optional[Icinga::Secret] $ticket_salt = undef,
Array[String] $extra_packages = [],
- Enum['file', 'syslog'] $logging_type = 'file',
+ Enum['file', 'syslog', 'eventlog'] $logging_type = 'file',
Optional[Icinga::LogLevel] $logging_level = undef,
String $cert_name = $facts['networking']['fqdn'],
Boolean $prepare_web = false,
@@ -90,14 +90,33 @@
features => [],
}
- # switch logging between mainlog and syslog
- # logging on windows only file is supported, warning output see below
- if $logging_type == 'file' or $facts['kernel'] == 'windows' {
- $_mainlog = 'present'
- $_syslog = 'absent'
+ # switch logging between mainlog, syslog and eventlog
+ if $facts['kernel'] != 'windows' {
+ if $logging_type == 'file' {
+ $_mainlog = 'present'
+ $_syslog = 'absent'
+ } else {
+ $_mainlog = 'absent'
+ $_syslog = 'present'
+ }
+
+ class { 'icinga2::feature::syslog':
+ ensure => $_syslog,
+ severity => $logging_level,
+ }
} else {
- $_mainlog = 'absent'
- $_syslog = 'present'
+ if $logging_type == 'file' {
+ $_mainlog = 'present'
+ $_eventlog = 'absent'
+ } else {
+ $_mainlog = 'absent'
+ $_eventlog = 'present'
+ }
+
+ class { 'icinga2::feature::windowseventlog':
+ ensure => $_eventlog,
+ severity => $logging_level,
+ }
}
class { 'icinga2::feature::mainlog':
@@ -105,11 +124,6 @@
severity => $logging_level,
}
- class { 'icinga2::feature::syslog':
- ensure => $_syslog,
- severity => $logging_level,
- }
-
case $facts['kernel'] {
'linux': {
$icinga_user = $icinga2::globals::user
diff --git a/manifests/server.pp b/manifests/server.pp
index dd85a7e..899ed3c 100644
--- a/manifests/server.pp
+++ b/manifests/server.pp
@@ -39,7 +39,7 @@
# Icinga API director user password.
#
# @param logging_type
-# Switch the log target. Only `file` is supported on Windows.
+# Switch the log target. On Windows `syslog` is ignored, `eventlog` on all other platforms.
#
# @param logging_level
# Set the log level.
@@ -49,21 +49,21 @@
# and add the Icinga user to this group.
#
class icinga::server (
- Boolean $ca = false,
- Boolean $config_server = false,
- String $zone = 'main',
- Hash[String,Hash] $colocation_endpoints = {},
- Hash[String,Hash] $workers = {},
- Array[String] $global_zones = [],
- Optional[Stdlib::Host] $ca_server = undef,
- Optional[Icinga::Secret] $ticket_salt = undef,
- String $web_api_user = 'icingaweb2',
- Optional[Icinga::Secret] $web_api_pass = undef,
- String $director_api_user = 'director',
- Optional[Icinga::Secret] $director_api_pass = undef,
- Enum['file', 'syslog'] $logging_type = 'file',
- Optional[Icinga::LogLevel] $logging_level = undef,
- Boolean $run_web = false,
+ Boolean $ca = false,
+ Boolean $config_server = false,
+ String $zone = 'main',
+ Hash[String,Hash] $colocation_endpoints = {},
+ Hash[String,Hash] $workers = {},
+ Array[String] $global_zones = [],
+ Optional[Stdlib::Host] $ca_server = undef,
+ Optional[Icinga::Secret] $ticket_salt = undef,
+ String $web_api_user = 'icingaweb2',
+ Optional[Icinga::Secret] $web_api_pass = undef,
+ String $director_api_user = 'director',
+ Optional[Icinga::Secret] $director_api_pass = undef,
+ Enum['file', 'syslog', 'eventlog'] $logging_type = 'file',
+ Optional[Icinga::LogLevel] $logging_level = undef,
+ Boolean $run_web = false,
) {
if empty($colocation_endpoints) {
$_ca = true
diff --git a/manifests/worker.pp b/manifests/worker.pp
index 94d5d6c..18f74a6 100644
--- a/manifests/worker.pp
+++ b/manifests/worker.pp
@@ -24,7 +24,7 @@
# List of global zones to configure.
#
# @param logging_type
-# Switch the log target. Only `file` is supported on Windows.
+# Switch the log target. On Windows `syslog` is ignored, `eventlog` on all other platforms.
#
# @param logging_level
# Set the log level.
@@ -34,16 +34,16 @@
# and add the Icinga user to this group.
#
class icinga::worker (
- Stdlib::Host $ca_server,
- String $zone,
- Hash[String, Hash] $parent_endpoints,
- String $parent_zone = 'main',
- Hash[String, Hash] $colocation_endpoints = {},
- Hash[String, Hash] $workers = {},
- Array[String] $global_zones = [],
- Enum['file', 'syslog'] $logging_type = 'file',
- Optional[Icinga::LogLevel] $logging_level = undef,
- Boolean $run_web = false,
+ Stdlib::Host $ca_server,
+ String $zone,
+ Hash[String, Hash] $parent_endpoints,
+ String $parent_zone = 'main',
+ Hash[String, Hash] $colocation_endpoints = {},
+ Hash[String, Hash] $workers = {},
+ Array[String] $global_zones = [],
+ Enum['file', 'syslog', 'eventlog'] $logging_type = 'file',
+ Optional[Icinga::LogLevel] $logging_level = undef,
+ Boolean $run_web = false,
) {
# inject parent zone if no parent exists
$_workers = $workers.reduce({}) |$memo, $worker| { $memo + { $worker[0] => { parent => $zone } + $worker[1] } }