Colleen Murphy 567ae88a96 Fix curator cron command string
The puppet syntax check complains about the '\%' in the cron command
string, but the % still does need to be escaped for the cron to work
properly. We double escape it here in the puppet string which will
result in a properly single-escaped command string in the crontab.

Change-Id: I3d97463a611c43ded12ddb788e9da5e13466e0c5
2017-06-14 00:32:56 +02:00

57 lines
1.6 KiB
Puppet

# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# ELK curator
#
class logstash::curator (
$cron_hour = '2',
$cron_minute = '0',
$keep_for_days = '14',
$pin_for_old_es = false,
) {
if ($pin_for_old_es) {
package { 'elasticsearch-curator':
ensure => '0.6.2',
provider => openstack_pip,
}
} else {
package { 'elasticsearch-curator':
# Pin until we add support for the new stuff in 4.0
ensure => '3.5.1',
provider => openstack_pip,
}
}
cron { 'cleanup_old_es_indices':
user => 'root',
hour => $cron_hour,
minute => $cron_minute,
environment => 'PATH=/usr/bin:/usr/local/bin',
command => "curator --logfile /var/log/curator.log delete indices --older-than ${keep_for_days} --time-unit days --timestring \\%Y.\\%m.\\%d"
}
include ::logrotate
logrotate::file { 'curator.log':
log => '/var/log/curator.log',
options => [
'compress',
'missingok',
'rotate 31',
'daily',
'notifempty',
],
}
}