Elukey has submitted this change and it was merged. Change subject: Override kafkatee's default logrotate/rsyslog configuration. ......................................................................
Override kafkatee's default logrotate/rsyslog configuration. This is a preparation step to remove logrotate/syslog configurations from the deb package. This is currently causing cronspam and logfiles not being rotated due to the absence of the 'syslog' user on oxygen (specified explicitly in the logrotate conf instead of root). The rsyslog/logrotate configurations will be gated by a boolean option and will leverage the rsyslog/logrotate modules. Bug: T132322 Change-Id: Ibbc2b6936769a0002729fbd721a89a85b8553206 --- A files/kafkatee_logrotate A files/kafkatee_rsyslog.conf M manifests/init.pp 3 files changed, 63 insertions(+), 10 deletions(-) Approvals: Elukey: Looks good to me, approved Ottomata: Looks good to me, but someone else must approve Faidon Liambotis: Looks good to me, but someone else must approve jenkins-bot: Verified diff --git a/files/kafkatee_logrotate b/files/kafkatee_logrotate new file mode 100644 index 0000000..d5cf51e --- /dev/null +++ b/files/kafkatee_logrotate @@ -0,0 +1,25 @@ +# NOTE: This file is managed by Puppet. + +/var/log/kafkatee.log { + daily + rotate 7 + create 0644 root adm + missingok + compress + delaycompress + postrotate + invoke-rc.d rsyslog rotate >/dev/null + endscript +} + +/var/cache/kafkatee/kafkatee.stats.json { + weekly + rotate 4 + create 0644 kafkatee root + missingok + compress + delaycompress + postrotate + invoke-rc.d kafkatee reload >/dev/null + endscript +} \ No newline at end of file diff --git a/files/kafkatee_rsyslog.conf b/files/kafkatee_rsyslog.conf new file mode 100644 index 0000000..49dc32c --- /dev/null +++ b/files/kafkatee_rsyslog.conf @@ -0,0 +1,4 @@ +# NOTE: This file is managed by Puppet. + +# rsyslogd kafkatee config. +if $programname == 'kafkatee' then /var/log/kafkatee.log \ No newline at end of file diff --git a/manifests/init.pp b/manifests/init.pp index ea66cf3..ae4d9da 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -10,31 +10,42 @@ # Default: /var/cache/kafkatee/offsets # $kafka_offset_reset - Where to consume from if the offset from which to # consume is not on the broker, or if there is no -# stored offset yet. One of: smallest, largest, error. +# stored offset yet. +# One of: smallest, largest, error. # Default: largest # $kafka_message_max_bytes - Maximum message size. Default: undef (4000000). # $pidfile - Location of kafkatee pidfile. # Default: /var/run/kafkatee/kafkatee.pid # $log_statistics_file - Path in which to store kafkatee .json statistics. # Default: /var/cache/kafkatee/kafkatee.stats.json -# $log_statistics_interval - How often to write statistics to $log_statistics_file. +# $log_statistics_interval - How often to write statistics to +# $log_statistics_file. # Default: 60 -# $output_encoding - If this is string and inputs are json, then the JSON -# input will be transformed according to $output_format -# before they are sent to the configured outputs. +# $output_encoding - If this is string and inputs are json, then the +# JSON input will be transformed according to +# $output_format before they are sent to +# the configured outputs. # Default: string -# $output_format - Format string with which to transform JSON data into -# string output. See kafkatee.conf documentation +# $output_format - Format string with which to transform JSON data +# into string output. See kafkatee.conf docs # for more info. Default: undef. # Default: SEE PARAMETER -# $output_queue_size - Maximum queue size for each output, in number of messages. +# $output_queue_size - Maximum queue size for each output, in +# number of messages. # Default: undef, (1000000) # $config_file - Main kafkatee config file. # Default: /etc/kafkatee.conf # $config_directory - kafkatee config include directory. # Default: /etc/kafkatee.d -# -class kafkatee( +# $configure_rsyslog - Add necessary configuration files for logrotate +# and rsyslog. The rsyslog/logrotate configuration +# are handled by two separate puppet modules +# (named rsyslog and logrotate), so setting this +# option to 'true' will require both of them to +# work properly. +# Default: true + +class kafkatee ( $kafka_brokers, $kafka_offset_store_path = '/var/cache/kafkatee/offsets', $kafka_offset_reset = 'largest', @@ -45,6 +56,7 @@ $output_encoding = 'string', $output_format = undef, $output_queue_size = undef, + $configure_rsyslog = true, ) { package { 'kafkatee': @@ -56,6 +68,18 @@ require => Package['kafkatee'], } + if $configure_rsyslog { + # Basic logrotate.d configuration to rotate /var/log/kafkatee.log + logrotate::conf { 'kafkatee': + source => 'puppet:///modules/kafkatee/kafkatee_logrotate', + } + # Basic rsyslog configuration to create /var/log/kafkatee.log + rsyslog::conf { 'kafkatee': + source => 'puppet:///modules/kafkatee/kafkatee_rsyslog.conf', + priority => 70, + } + } + service { 'kafkatee': ensure => 'running', # lint:ignore:quoted_booleans -- To view, visit https://gerrit.wikimedia.org/r/283411 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ibbc2b6936769a0002729fbd721a89a85b8553206 Gerrit-PatchSet: 9 Gerrit-Project: operations/puppet/kafkatee Gerrit-Branch: master Gerrit-Owner: Elukey <ltosc...@wikimedia.org> Gerrit-Reviewer: Elukey <ltosc...@wikimedia.org> Gerrit-Reviewer: Faidon Liambotis <fai...@wikimedia.org> Gerrit-Reviewer: Ottomata <o...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits