OLD | NEW |
(Empty) | |
| 1 # == Type: adblockplus::log::rotation |
| 2 # |
| 3 # Setup rotation for a particular log file. |
| 4 # |
| 5 # === Parameters: |
| 6 # |
| 7 # [*count*] |
| 8 # How many intervals to keep rotated logs (see $interval). |
| 9 # |
| 10 # [*ensure*] |
| 11 # Either 'present' or 'absent'/'purged'. |
| 12 # |
| 13 # [*interval*] |
| 14 # Either 'daily', 'weekly', 'monthly', or 'yearly'. |
| 15 # |
| 16 # [*path*] |
| 17 # The full path to the file to rotate, defaults to "/var/log/$name". |
| 18 # |
| 19 # [*postrotate*] |
| 20 # A single command string or multiple commands in array form, to |
| 21 # become exectued after every successful rotation. |
| 22 # |
| 23 # [*upload*] |
| 24 # Whether to export the rotated *.1.gz to the $adblockplus::log::uplink. |
| 25 # |
| 26 # === Examples: |
| 27 # |
| 28 # adblockplus::log::rotation {'nginx_error_log': |
| 29 # count => 30, |
| 30 # ensure => 'present', |
| 31 # interval => 'daily', |
| 32 # path => '/var/log/nginx/error.log', |
| 33 # postrotate => [ |
| 34 # '[ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`', |
| 35 # ], |
| 36 # upload => true, |
| 37 # } |
| 38 # |
| 39 define adblockplus::log::rotation ( |
| 40 $count = 30, |
| 41 $ensure = 'present', |
| 42 $interval = 'daily', |
| 43 $path = "/var/log/$name", |
| 44 $postrotate = [], |
| 45 $upload = false, |
| 46 ) { |
| 47 |
| 48 include adblockplus::log |
| 49 include logrotate |
| 50 |
| 51 logrotate::config {$title: |
| 52 content => template('adblockplus/log/rotation.erb'), |
| 53 ensure => $ensure, |
| 54 name => $name, |
| 55 } |
| 56 } |
OLD | NEW |