| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 # == Type: adblockplus::log::tracker | 1 # == Type: adblockplus::log::tracker |
| 2 # | 2 # |
| 3 # Establish monitoring for a single log-file source on the current node, | 3 # Establish monitoring for a single log-file source on the current node, |
| 4 # connected to the adblockplus::log::forwarder output, if any. | 4 # connected to the adblockplus::log::forwarder output, if any. |
| 5 # | 5 # |
| 6 # === Parameters: | 6 # === Parameters: |
| 7 # | 7 # |
| 8 # [*ensure*] | 8 # [*ensure*] |
| 9 # Whether the tracker is supposed to be 'present' or 'absent', defaults | 9 # Whether the tracker is supposed to be 'present' or 'absent', defaults |
| 10 # to $adblockplus::log::ensure. | 10 # to $adblockplus::log::ensure. |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 # === Examples: | 23 # === Examples: |
| 24 # | 24 # |
| 25 # adblockplus::log::tracker {'example1': | 25 # adblockplus::log::tracker {'example1': |
| 26 # format => 'nginx', | 26 # format => 'nginx', |
| 27 # name => 'foobar.access', | 27 # name => 'foobar.access', |
| 28 # path => '/var/log/nginx/access.log', | 28 # path => '/var/log/nginx/access.log', |
| 29 # } | 29 # } |
| 30 # | 30 # |
| 31 # adblockplus::log::tracker {'example2': | 31 # adblockplus::log::tracker {'example2': |
| 32 # path => '/var/log/nginx/error.log', | 32 # path => '/var/log/nginx/error.log', |
| 33 # name => 'foorbar.error', | 33 # name => 'foobar.error', |
|
Fred
2016/04/06 18:03:03
typo (foobar)
mathias
2016/04/06 19:16:27
Acknowledged.
| |
| 34 # format => '/^(?<message>.+)$/', | 34 # format => '/^(?<message>.+)$/', |
| 35 # } | 35 # } |
| 36 # | 36 # |
| 37 # adblockplus::log::tracker {'/var/log/other.log': | 37 # adblockplus::log::tracker {'/var/log/other.log': |
| 38 # ensure => 'absent', | 38 # ensure => 'absent', |
| 39 # } | 39 # } |
| 40 # | 40 # |
| 41 define adblockplus::log::tracker ( | 41 define adblockplus::log::tracker ( |
| 42 $ensure = undef, | 42 $ensure = undef, |
| 43 $format = '/^(?<message>.*)$/', | 43 $format = '/^(?<message>.*)$/', |
| 44 $path = $title, | 44 $path = $title, |
| 45 ) { | 45 ) { |
| 46 | 46 |
| 47 include adblockplus::log::forwarder | 47 include adblockplus::log::forwarder |
| 48 include stdlib | 48 include stdlib |
| 49 | 49 |
| 50 # Used as $title for all resource definitions contained herein | 50 # Used as $title for all resource definitions contained herein |
| 51 $namevar = "adblockplus::log::tracker#$title" | 51 $namevar = "adblockplus::log::tracker#$title" |
| 52 | 52 |
| 53 # See modules/fluent/manifests/config.pp | 53 # See modules/fluent/manifests/config.pp |
| 54 fluent::config {$namevar: | 54 fluent::config {$namevar: |
| 55 content => template('adblockplus/log/fluentd/tracker.conf.erb'), | 55 content => template('adblockplus/log/fluentd/tracker.conf.erb'), |
| 56 ensure => pick($ensure, $adblockplus::log::ensure), | 56 ensure => pick($ensure, $adblockplus::log::ensure), |
| 57 name => sprintf('20-adblockplus-log-tracker-%s', md5($path)), | 57 name => sprintf('20-adblockplus-log-tracker-%s', md5($path)), |
| 58 } | 58 } |
| 59 } | 59 } |
| LEFT | RIGHT |