Remove atop logrotate configuration

The previous logrotate configuration was improperly rotating the log
file which is not necessary due to the daily restart of atop. The
binary retention is now handled via a new atop retention cron. This
change removes the atop logrotate configuration.

Change-Id: I76e3c12b46946ed7c48719f51e953528708c2d4b
Closes-Bug: 1452389
This commit is contained in:
Alex Schultz 2015-05-04 10:54:38 -05:00
parent be2aa0818e
commit 95a6dc7cc7
3 changed files with 15 additions and 38 deletions

View File

@ -55,10 +55,11 @@ class osnailyfacter::atop (
}
# This file is used for atop binary log rotations by (ana)cron
file { '/etc/logrotate.d/atop':
file { '/etc/cron.daily/atop_retention':
owner => 'root',
group => 'root',
mode => '0644',
content => template('osnailyfacter/atop_logrotate.conf.erb'),
mode => '0755',
content => template('osnailyfacter/atop_retention.erb'),
}
}

View File

@ -1,35 +0,0 @@
# managed by puppet
"<%= @logpath %>/atop*"
{
# This file is used for atop binary files rotation
# Will keep binary files for last <%= @rotate %> days instead of 30 days provided by atop
# Do not modify its settings if not sure
daily
rotate <%= @rotate %>
nocompress
nocreate
missingok
notifempty
dateext
sharedscripts
lastaction
<% if @osfamily == 'RedHat' -%>
/bin/find <%= @logpath %> -type f -name 'atop_*' -mtime +<%= @rotate %> -delete
<% elsif @osfamily == 'Debian' -%>
/usr/bin/find <%= @logpath %> -type f -name 'atop_*' -mtime +<%= @rotate %> -delete
<% else -%>
/bin/sh -c "find <%= @logpath %> -type f -name 'atop_*' -mtime +<%= @rotate %> -delete"
<% end -%>
/bin/ln -f -s <%= @logpath %>/atop_$(date +%Y%m%d) <%= @logpath %>/atop_current
endscript
postrotate
<% if @osfamily == 'RedHat' -%>
/sbin/service atop restart 2>&1 >/dev/null
<% elsif @osfamily == 'Debian' -%>
/usr/sbin/service atop restart 2>&1 >/dev/null
<% else -%>
/bin/sh -c "service atop restart 2>&1 >/dev/null"
<% end -%>
endscript
}

View File

@ -0,0 +1,11 @@
#!/bin/bash
# Managed by puppet
# This file manages the atop binary files. It will keep binary files for last
# <%= @rotate %> days instead of 30 days provided by atop.
PATH=/sbin:/bin:/usr/sbin:/usr/bin
# remove files older than <%= @rotate %> days
find <%= @logpath %> -type f -name 'atop_*' -mtime +<%= @rotate %> -delete
# link current to todays file
ln -f -s <%= @logpath %>/atop_$(date +%Y%m%d) <%= @logpath %>/atop_current