How to rotate /var/log/chef/client.log?


#1

Hi, Folks!

Is there a best practice for rotating chef client logs?
I was thinking about using report/exception handler to rotate the log once
a day.
(http://wiki.opscode.com/display/chef/Exception+and+Report+Handlers)

-Steve


#2

I usually just use the logrotate cookbook, which works great.

On Mon, Jul 23, 2012 at 4:21 PM, Steve Jang estebanjang@gmail.com wrote:

Hi, Folks!

Is there a best practice for rotating chef client logs?
I was thinking about using report/exception handler to rotate the log once
a day.
(http://wiki.opscode.com/display/chef/Exception+and+Report+Handlers)

-Steve


#3

Logrotate worked for me too. I never got back around to setting up
logging via syslog. Anyone else go that route with good results?

KC

On Mon, Jul 23, 2012 at 2:25 PM, Larry Wright larrywright@gmail.com wrote:

I usually just use the logrotate cookbook, which works great.

On Mon, Jul 23, 2012 at 4:21 PM, Steve Jang estebanjang@gmail.com wrote:

Hi, Folks!

Is there a best practice for rotating chef client logs?
I was thinking about using report/exception handler to rotate the log once
a day.
(http://wiki.opscode.com/display/chef/Exception+and+Report+Handlers)

-Steve


#4

My only issue with using logrotate, is that if chef-client is mid-run at
the time logrotate executes, it gets killed.

Rgds,

mgh

On Tue, Jul 24, 2012 at 9:21 AM, KC Braunschweig
kcbraunschweig@gmail.comwrote:

Logrotate worked for me too. I never got back around to setting up
logging via syslog. Anyone else go that route with good results?

KC

On Mon, Jul 23, 2012 at 2:25 PM, Larry Wright larrywright@gmail.com
wrote:

I usually just use the logrotate cookbook, which works great.

On Mon, Jul 23, 2012 at 4:21 PM, Steve Jang estebanjang@gmail.com
wrote:

Hi, Folks!

Is there a best practice for rotating chef client logs?
I was thinking about using report/exception handler to rotate the log
once

a day.
(http://wiki.opscode.com/display/chef/Exception+and+Report+Handlers)

-Steve


#5

Are you doing a restart as part of the rotation? You could do
copytruncate and skip the restart. Logs might get split mid run but it
shouldn’t stop the run.

KC

On Mon, Jul 23, 2012 at 4:44 PM, Michael Herman mgh@historyhound.com wrote:

My only issue with using logrotate, is that if chef-client is mid-run at the
time logrotate executes, it gets killed.

Rgds,

mgh

On Tue, Jul 24, 2012 at 9:21 AM, KC Braunschweig kcbraunschweig@gmail.com
wrote:

Logrotate worked for me too. I never got back around to setting up
logging via syslog. Anyone else go that route with good results?

KC

On Mon, Jul 23, 2012 at 2:25 PM, Larry Wright larrywright@gmail.com
wrote:

I usually just use the logrotate cookbook, which works great.

On Mon, Jul 23, 2012 at 4:21 PM, Steve Jang estebanjang@gmail.com
wrote:

Hi, Folks!

Is there a best practice for rotating chef client logs?
I was thinking about using report/exception handler to rotate the log
once
a day.
(http://wiki.opscode.com/display/chef/Exception+and+Report+Handlers)

-Steve


#6

On Mon, Jul 23, 2012 at 7:44 PM, Michael Herman mgh@historyhound.com wrote:

My only issue with using logrotate, is that if chef-client is mid-run at the
time logrotate executes, it gets killed.

It seems like an enhancement to continue a run on TERM would be
worthwhile too, probably implemented similarly to how the USR1 signal
triggers a run but won’t interrupt an existing run.

Bryan


#7

On Mon, Jul 23, 2012 at 6:09 PM, Bryan McLellan btm@loftninjas.org wrote:

On Mon, Jul 23, 2012 at 7:44 PM, Michael Herman mgh@historyhound.com wrote:

My only issue with using logrotate, is that if chef-client is mid-run at the
time logrotate executes, it gets killed.

It seems like an enhancement to continue a run on TERM would be
worthwhile too, probably implemented similarly to how the USR1 signal
triggers a run but won’t interrupt an existing run.

Agreed. This would also fix the issue that you make a change to a chef
config (/etc/sysconfig/chef-client for example) which needs a restart
of chef-client but calling the restart in mid run kills the run and
the daemon, requiring a manual start to recover.

KC