add define for logs
This commit is contained in:
20
manifests/log_targets.pp
Normal file
20
manifests/log_targets.pp
Normal file
@@ -0,0 +1,20 @@
|
||||
## confdroid_alloy::log_targets.pp
|
||||
# Module name: confdroid_alloy
|
||||
# @summary Adds log file targets to the Alloy configuration.
|
||||
# @param [Array[String]] targets Paths to log files to scrape.
|
||||
###############################################################################
|
||||
define confdroid_alloy::log_targets (
|
||||
|
||||
Array[String] $targets = [],
|
||||
|
||||
) {
|
||||
if $confdroid_alloy::params::ay_manage_loki == true and $targets != [] {
|
||||
$log_targets_array = $targets
|
||||
|
||||
concat::fragment { "log_targets_${name}":
|
||||
target => $confdroid_alloy::params::ay_main_file,
|
||||
content => template('confdroid_alloy/log_targets.alloy.erb'),
|
||||
order => '020',
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,12 +7,12 @@ class confdroid_alloy::main::files (
|
||||
|
||||
) inherits confdroid_alloy::params {
|
||||
require confdroid_alloy::main::dirs
|
||||
include concat
|
||||
|
||||
# Ensure log_targets is always an array
|
||||
$log_targets_array = Array($confdroid_alloy::params::ay_log_targets, true)
|
||||
|
||||
file { $ay_main_file:
|
||||
ensure => file,
|
||||
concat { $ay_main_file:
|
||||
ensure => present,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0644',
|
||||
@@ -20,10 +20,29 @@ class confdroid_alloy::main::files (
|
||||
selrole => object_r,
|
||||
seltype => etc_t,
|
||||
seluser => system_u,
|
||||
content => template('confdroid_alloy/config.alloy.erb'),
|
||||
notify => Service[$ay_service],
|
||||
}
|
||||
|
||||
concat::fragment { 'confdroid_alloy_config_header':
|
||||
target => $ay_main_file,
|
||||
content => template('confdroid_alloy/config.alloy.erb'),
|
||||
order => '001',
|
||||
}
|
||||
|
||||
if $ay_manage_loki == true {
|
||||
concat::fragment { 'confdroid_alloy_log_targets_default':
|
||||
target => $ay_main_file,
|
||||
content => template('confdroid_alloy/log_targets.alloy.erb'),
|
||||
order => '010',
|
||||
}
|
||||
}
|
||||
|
||||
concat::fragment { 'confdroid_alloy_config_tail':
|
||||
target => $ay_main_file,
|
||||
content => template('confdroid_alloy/config.alloy.tail.erb'),
|
||||
order => '999',
|
||||
}
|
||||
|
||||
# manage logrotate for rsyslog to allow adm group membership
|
||||
file { '/etc/logrotate.d/rsyslog':
|
||||
ensure => file,
|
||||
|
||||
Reference in New Issue
Block a user