sensu / sensu-chef

Sensu Chef cookbook.
https://supermarket.chef.io/cookbooks/sensu
Apache License 2.0
222 stars 283 forks source link

Add support for log rotate on Windows #607

Closed evandervecht closed 6 years ago

evandervecht commented 6 years ago

I refactored the https://github.com/sensu/sensu-chef/pull/581 PR. (that one can be closed).

Description

[Windows|Linux] Updated installation to 1.2.0 (havent tested with 1.3.x yet) If needed I can make a PR just for installing a newer version first, then another PR to support logrotate. DEfaulting to 1.2.0 as 1.0.0 is out since mid 2017. [Windows] Repo url same as sensu-puppet. [Windows] In recipe created if statement to check whether you have a 32/64 bit OS. [Windows] Updated client xml to support log rotating the in the sensu log folder. ["sensu"]["log_directory"] Log folder can be any folder as logn as the file name is sensu-client.out

Motivation and Context

Log file on Windows was not being rotated. This caused disk to fill up. https://github.com/sensu/sensu-chef/issues/580

How Has This Been Tested?

Tested this on Windows 2016 & CentOS 7, Chef client 12.19.36 Run Chef-client, see if it installs the newer version, check if the client.xml is being changed. See if the log file is being rotated (tested with 10kb else I would have to wait for a much longer time)

Screenshots (if appropriate):

afbeelding Please note that the rotate was set to 10kb but after running Chef it was changed to 10 MB, therefor the sensu-client.out is larger than the rotated files.

Types of changes

Checklist:

majormoses commented 6 years ago

I reached out to some folks in the chef slack windows channel and it looks like node['kernel']['os_info']['name'] might be the way to go rather than the kernel version. I will review this later but just wanted to get that out to you.

majormoses commented 6 years ago

I rebased your fork to fix conflicts.

majormoses commented 6 years ago

released: https://supermarket.chef.io/cookbooks/sensu/versions/5.1.0