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