QuickFix: Cleaning up Puppet master’s report logs

OK… Our puppet master’s disk is slowly filling up with logs… We have around 70+ nodes already so no wonder it’s filling up at a high rate:

marionette-disk

I’ve known about the problem since 2 weeks ago but I always had an excuse to put it in my “next” to-do pile….

Well, today I can’t ignore it anymore since it’s almost full🙂

So off to Google and do a little searching… And this is the best answer that I got:

tidy { "/var/lib/puppet/reports":
  age => "1w",
  recurse => true,
}

Duh! Use puppet to clean-up Puppet logs! *facepalm* (I felt stupid when I realized this…)

After knowing a new puppet type, I was excited to do a test run: puppet agent -t

Well… The ruby process ran for a few a minutes but it did nothing! Hmmm… I figured maybe because the number of files is staggering that’s why the puppet run can’t handle it. After all, I have >4GB worth of log files in /var/lib/puppet/reports/.

So a little help is needed then. I ran these commands to give puppet a hand:
find /var/lib/puppet/reports/ -type f -ctime +7 | xargs -P 4 -n 20 rm -f

And the next succeeding puppet runs worked like a charm🙂

marionette-disk1

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s