cookbook 'windows_logrotate', '= 0.2.1'
windows_logrotate (4) Versions 0.2.1 Follow0
Installs/Configures LogRotate for Windows
cookbook 'windows_logrotate', '= 0.2.1', :supermarket
knife supermarket install windows_logrotate
knife supermarket download windows_logrotate
Windows LogRotate Cookbook
Installs/configures Ken Salter's
LogRotate for Windows.
This is a Windows implementation of the logrotate utility found in
Linux platforms.
Supported logrotate configuration options:
https://sourceforge.net/p/logrotatewin/wiki/LogRotate/#configuration-file
Requirements
- Chef 12.6+
- .NET Framework v4.5
Platform
- Windows
Usage
Use windows_logrotate resource to install and configure logrotate, and
create a scheduled task to run it periodically.
Example
windows_logrotate 'logrotate test' do username user password pass run_immediately true confidential false conf <<-EOF C:\\test.log { missingok compress delaycompress copytruncate notifempty rotate 5 daily prerotate @echo off echo This is a test echo parameter pass %1 VER | TIME > TEMP.BAT ECHO SET TIME=%%3>CURRENT.BAT DEL TEMP.BAT DEL CURRENT.BAT ECHO It's %TIME% now endscript } EOF end
Attributes
-
name
- The name of logrotate configuration file to create. Defaults to resource block name. -
username
- The username to create scheduled task as. Default:Administrator
. -
password
- Required to create scheduled task. -
conf
- Required logroate configuration. -
verbose
- Turns on verbose mode. -
force
- Tells logrotate to force the rotation, even if it doesn't think this is necessary. Sometimes this is useful after adding new entries to a logrotate config file, or if old log files have been removed by hand, as the new files will be created, and logging will continue correctly. -
run_immediately
- Runs scheduled task immediately after creating or updating logrotate configuration. -
cookbook
- The cookbook that contains the template for logrotate conf. Users can provide their own template by setting this attribute to point at a different cookbook. Default:windows_logrotate
. -
conf_tmpl
- Sets the conf template source. Default:logrotate.conf.erb
. -
schtask_tmpl
- Sets the schtask template source. Default:schtask.xml.erb
.
ChefSpec Matchers
This cookbook includes custom
ChefSpec matchers you can
use to test your own cookbooks.
Example Matcher Usage
expect(chef_run).to enable_windows_logrotate('resource_name')
Cookbook Matchers
- enable_windows_logrotate(resource_name)
Getting Help
- Ask specific questions on Stack Overflow.
- Report bugs and discuss potential features in Github issues.
Contributing
Please refer to
CONTRIBUTING.
License
MIT - see the accompanying
LICENSE
file for details.
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
CHANGELOG
0.2.1 2017-10-25
- Update version of logrotate installer
0.2.0 2017-06-07
- Replace sensitive attribute with confidential attribute for Chef 13
- Flagged password as sensitive for Chef 13
0.1.0 2017-01-20
- Initial release using logrotateSetup v0.0.0.17
License Metric
0.2.1 passed this metric
0.2.1 passed this metric