Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: modules/adblockplus/manifests/log.pp

Issue 29339248: Issue 3305 - Introduce adblockplus::log::tracker and ::forwarder (Closed)
Patch Set: Issue 3305 - Fix typos in documentation Created April 7, 2016, 7:29 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | modules/adblockplus/manifests/log/forwarder.pp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: modules/adblockplus/manifests/log.pp
diff --git a/modules/adblockplus/manifests/log.pp b/modules/adblockplus/manifests/log.pp
index c1137b1c06dc95e20dc90cc20007b316c1fb3315..9f7038d4af54e2b7d5ef946aa2814ee75c23770d 100644
--- a/modules/adblockplus/manifests/log.pp
+++ b/modules/adblockplus/manifests/log.pp
@@ -7,28 +7,40 @@
# [*ensure*]
# Whether associated resources are ment to be 'present' or 'absent'.
#
+# [*name*]
+# Used as label to connect adblockplus::log::tracker instances to class
+# adblockplus::log::forwarder, defaults to 'adblockplus::log'.
+#
# [*rotations*]
# A hash of adblockplus::log::rotation $name => $parameter items
# to set up in this context, i.e. via Hiera.
#
+# [*trackers*]
+# A hash of adblockplus::log::rotation $title => $parameter items
+# to set up in this context, i.e. via Hiera.
+#
# === Examples:
#
# class {'adblockplus::log':
# rotations => {
# # see adblockplus::log::rotation
# },
+# trackers => {
+# # see adblockplus::log::tracker
+# },
# }
#
class adblockplus::log (
$ensure = 'present',
$rotations = hiera('adblockplus::log::rotations', {}),
+ $trackers = hiera('adblockplus::log::trackers', {}),
) {
include adblockplus
+ include stdlib
# Used as internal constants within adblockplus::log::* resources
- $directory = "$adblockplus::directory/log"
- $group = 'adm'
+ $directory = "$adblockplus::directory/log/data"
$user = 'log'
# Required on both log generating and log processing hosts
@@ -41,27 +53,47 @@ class adblockplus::log (
provider => 'apt',
},
user => {
- groups => [$group],
+ groups => ['adm'],
shell => '/bin/sh',
- }
+ },
+ }
+
+ # Used as internal shortcuts within adblockplus::log::* resources
+ $agent = getparam(Package['fluent'], 'name')
+ $index = sprintf('/var/run/%s/index.csv', $agent)
+ $group = getparam(User['fluent'], 'gid')
+
+ fluent::config {$title:
+ content => template('adblockplus/log/fluentd/default.conf.erb'),
+ ensure => $ensure,
+ name => '90-adblockplus-log-defaults',
}
# Invoke realize(File[$adblockplus::log::directory]) when neccessary
@file {$directory:
+ before => Service['fluent'],
ensure => 'directory',
group => $group,
- mode => 0750,
- owner => 'root',
- require => File[$adblockplus::directory],
+ mode => 0775,
+ owner => $user,
}
# Invoke realize(User[$adblockplus::log::user]) when necessary
@user {$user:
+ before => File[$directory],
ensure => $ensure,
- managehome => true,
groups => [$group],
+ home => "$adblockplus::directory/log",
+ managehome => true,
+ require => [
+ File[$adblockplus::directory],
+ User['fluent'],
+ ],
}
# See modules/adblockplus/manifests/log/rotation.pp
create_resources('adblockplus::log::rotation', $rotations)
+
+ # See modules/adblockplus/manifests/log/tracker.pp
+ create_resources('adblockplus::log::tracker', $trackers)
}
« no previous file with comments | « no previous file | modules/adblockplus/manifests/log/forwarder.pp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld