compress old puppet reports

Stephen John Smoogen smooge at gmail.com
Mon May 16 22:04:41 UTC 2011


On Mon, May 16, 2011 at 15:17, Kevin Fenzi <kevin at scrye.com> wrote:
> On Mon, 16 May 2011 16:55:27 -0400
> seth vidal <skvidal at fedoraproject.org> wrote:
>
>> Puppet reports have grown since we switched from 0.25 to 2.6.X by
>> roughly 10x their original size.
>>
>> so they are sucking the disk space out of puppet1 b/c we keep them
>> there.
>>
>> When I reduced the number we keep it didn't have as nice of an impact
>> on our free space as I would like.
>>
>> So - I wrote this to modify our reports clean up to compress all .yaml
>> files except for the latest 24hours worth of them.
>>
>> It keeps 1month present - but much, much, smaller
>>
>> and it keeps the latest 24 hours worth immediately available.
>>
>> here's the patch:
>>
>>
>> diff --git a/modules/puppet/files/puppet-report-clean.sh
>> b/modules/puppet/files/puppet-report-clean.sh
>> index d274e2b..d4af330 100755
>> --- a/modules/puppet/files/puppet-report-clean.sh
>> +++ b/modules/puppet/files/puppet-report-clean.sh
>> @@ -2,3 +2,11 @@
>>
>>  # clean up all but the last 1 month of puppet reports
>>  /usr/sbin/tmpwatch --mtime 720 /var/lib/puppet/reports/
>> +
>> +# compress all the .yaml files per host dir, except for the latest 24
>> hours worth.
>> +# since they are txt files and compress really well
>> +
>> +for host in `echo /var/lib/puppet/reports/*`
>> +do
>> + /bin/ls -1 $host/*.yaml | head --lines=-48 | xargs --no-run-if-empty
>> xz -9
>> +done
>>
>>
>>
>> need two +1's please
>
> +1. xz for the win.

+1 as I catchup with emails.





-- 
Stephen J Smoogen.
"The core skill of innovators is error recovery, not failure avoidance."
Randy Nelson, President of Pixar University.
"Let us be kind, one to another, for most of us are fighting a hard
battle." -- Ian MacLaren


More information about the infrastructure mailing list