Log rotation for chef client on Windows

Hello all,
I've noticed that our chef-client log is huge on some of our servers.
Looks like non-Windows has a build in log rotate - is there a similar solution for windows?

Regardless to the rotation, is it possible to send the logs to a local file and to a syslog server?

Thanks!

1 Like

Any thoughts?
I found a logrotate cookbook for Windows - is that the right solution? does it know to deal with a locked log in case Chef client is running?

To quote a Sunday morning cartoon of my youth.

"Hey, Rocky, watch me pull a logfile out of my hat!"

"Bullwinkle, that trick never works!!!"

If the logrotate is a scheduled task that happens apart from runs of chef-client, then yes, that could work. If not, then it could be trying to rolocate the file that the task, itself, is writing to. Windows based filesystems do not deal with this well.

I use the chef-client cookbook to enforce settings. There are parameters for logging setup

:slight_smile:
How do you take care of log rotation on windows clients?
I'll give that cookbook a try...
(https://supermarket.chef.io/cookbooks/windows_logrotate#readme)

I don't think that log rotation using the chef client cookbook is working on Windows... we are using that cookbook and its not rotating the logs...

I didn’t realize you were using windows. Currently logrotate doesn’t support windows only *nix platforms.

https://github.com/chef-cookbooks/chef-client/issues/451

found this tool. Not sure if it will work for you though. LogRotateWin download | SourceForge.net

Yes, that cookbook on supertmarket is based on that link you provided:
https://supermarket.chef.io/cookbooks/windows_logrotate#readme

Wanted to update that this cookbook works pretty well! only thing that i couldn't figure out is a way to make it zip the files rather then gz (which is not a big deal but not as easy to work with in case we need to troubleshoot).
when using zip extension the file get corrupted.