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

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

Issue 29333281: Issue 3307 - Introduce class adblockplus::log::rotation (Closed)
Patch Set: Created Jan. 7, 2016, 1:14 p.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 | « modules/adblockplus/manifests/log.pp ('k') | modules/adblockplus/templates/log/rotation.erb » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: modules/adblockplus/manifests/log/rotation.pp
diff --git a/modules/adblockplus/manifests/log/rotation.pp b/modules/adblockplus/manifests/log/rotation.pp
new file mode 100644
index 0000000000000000000000000000000000000000..cf1ec6e0f682160ff27aea03ba728f6942b98856
--- /dev/null
+++ b/modules/adblockplus/manifests/log/rotation.pp
@@ -0,0 +1,56 @@
+# == Type: adblockplus::log::rotation
+#
+# Setup rotation for a particular log file.
+#
+# === Parameters:
+#
+# [*count*]
+# How many intervals to keep rotated logs (see $interval).
+#
+# [*ensure*]
+# Either 'present' or 'absent'/'purged'.
+#
+# [*interval*]
+# Either 'daily', 'weekly', 'monthly', or 'yearly'.
+#
+# [*path*]
+# The full path to the file to rotate, defaults to "/var/log/$name".
+#
+# [*postrotate*]
+# A single command string or multiple commands in array form, to
+# become exectued after every successful rotation.
+#
+# [*upload*]
+# Whether to export the rotated *.1.gz to the $adblockplus::log::uplink.
+#
+# === Examples:
+#
+# adblockplus::log::rotation {'nginx_error_log':
+# count => 30,
+# ensure => 'present',
+# interval => 'daily',
+# path => '/var/log/nginx/error.log',
+# postrotate => [
+# '[ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`',
+# ],
+# upload => true,
+# }
+#
+define adblockplus::log::rotation (
+ $count = 30,
+ $ensure = 'present',
+ $interval = 'daily',
+ $path = "/var/log/$name",
+ $postrotate = [],
+ $upload = false,
+) {
+
+ include adblockplus::log
+ include logrotate
+
+ logrotate::config {$title:
+ content => template('adblockplus/log/rotation.erb'),
+ ensure => $ensure,
+ name => $name,
+ }
+}
« no previous file with comments | « modules/adblockplus/manifests/log.pp ('k') | modules/adblockplus/templates/log/rotation.erb » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld