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 # | |
26 # === Examples: | 23 # === Examples: |
27 # | 24 # |
28 # adblockplus::log::rotation {'nginx_error_log': | 25 # adblockplus::log::rotation {'nginx_error_log': |
29 # count => 30, | 26 # count => 30, |
30 # ensure => 'present', | 27 # ensure => 'present', |
31 # interval => 'daily', | 28 # interval => 'daily', |
32 # path => '/var/log/nginx/error.log', | 29 # path => '/var/log/nginx/error.log', |
33 # postrotate => [ | 30 # postrotate => [ |
34 # '[ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`', | 31 # '[ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`', |
35 # ], | 32 # ], |
36 # upload => true, | |
37 # } | 33 # } |
38 # | 34 # |
39 define adblockplus::log::rotation ( | 35 define adblockplus::log::rotation ( |
40 $count = 30, | 36 $count = 30, |
41 $ensure = 'present', | 37 $ensure = 'present', |
42 $interval = 'daily', | 38 $interval = 'daily', |
43 $path = "/var/log/$name", | 39 $path = "/var/log/$name", |
44 $postrotate = [], | 40 $postrotate = [], |
45 $upload = false, | |
46 ) { | 41 ) { |
47 | 42 |
48 include adblockplus::log | 43 include adblockplus::log |
49 include logrotate | 44 include logrotate |
50 | 45 |
51 logrotate::config {$title: | 46 logrotate::config {$title: |
52 content => template('adblockplus/log/rotation.erb'), | 47 content => template('adblockplus/log/rotation.erb'), |
53 ensure => $ensure, | 48 ensure => $ensure, |
54 name => $name, | 49 name => $name, |
55 } | 50 } |
56 } | 51 } |
OLD | NEW |