Coder Social home page Coder Social logo

maxnasonov / chef-windows_logrotate Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mpetka/chef-windows_logrotate

0.0 2.0 0.0 31 KB

Chef cookbook to install and configure logrotatewin

Home Page: https://github.com/plecos/logrotatewin

License: MIT License

Ruby 80.47% HTML 19.53%

chef-windows_logrotate's Introduction

Windows LogRotate Cookbook

Cookbook Version Build Status

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

Contributing

Please refer to CONTRIBUTING.

License

MIT - see the accompanying LICENSE file for details.

chef-windows_logrotate's People

Contributors

thethorne48 avatar thorne1l avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.