forked from chef-boneyard/cookbooks
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
150 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
= DESCRIPTION: | ||
|
||
Logrotate configuration | ||
|
||
= REQUIREMENTS: | ||
|
||
Debian or Ubuntu preferred. | ||
|
||
Red Hat/CentOS and Fedora can be used but will be converted to a Debian/Ubuntu style Apache as it's far easier to manage with chef. | ||
|
||
= ATTRIBUTES: | ||
|
||
* none | ||
|
||
General settings and prefork/worker attributes are tunable. | ||
|
||
= USAGE: | ||
|
||
include the recipe and it will install a default logrotate, if you want it to do more however... | ||
|
||
make a recipe such as, | ||
|
||
logrotate_app "chef" do | ||
paths "/var/log/chef/*.log" | ||
rotate 4 | ||
end | ||
|
||
== Defines: | ||
|
||
* logrotate_app:: sets up a logrotate configuration file | ||
|
||
= LICENSE & AUTHOR: | ||
|
||
Author:: Scott M. Likens (<scott@likens.us>) | ||
Copyright:: 2009, Scott M. Likens | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# | ||
# Cookbook Name:: logrotate | ||
# Definition:: logrotate_instance | ||
# | ||
# Copyright 2009, Scott M. Likens | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
define :logrotate_app, :enable => true do | ||
include_recipe "logrotate" | ||
|
||
if params[:enable] | ||
template "/etc/logrotate.d/#{params[:name]}" do | ||
source "logrotate.erb" | ||
mode 0440 | ||
owner "root" | ||
group "root" | ||
backup false | ||
variables( | ||
:paths => params[:paths], | ||
:rotate => params[:rotate] | ||
) | ||
end | ||
else | ||
execute "rm /etc/logrotate.d/#{params[:name]}" do | ||
only_if FileTest.exists?("/etc/logrotate.d/#{params[:name]}") | ||
command "rm /etc/logrotate.d/#{params[:name]}" | ||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,49 @@ | ||
{ | ||
"dependencies": { | ||
}, | ||
"replacing": { | ||
}, | ||
"description": "Installs logrotate", | ||
"groupings": { | ||
}, | ||
"platforms": { | ||
"ubuntu": [ | ||
|
||
], | ||
"centos": [ | ||
|
||
], | ||
"debian": [ | ||
|
||
], | ||
"redhat": [ | ||
|
||
] | ||
}, | ||
"version": "0.7.0", | ||
"recommendations": { | ||
}, | ||
"name": "logrotate", | ||
"maintainer": "Opscode, Inc.", | ||
"long_description": "", | ||
"recipes": { | ||
}, | ||
"suggestions": { | ||
}, | ||
"maintainer_email": "cookbooks@opscode.com", | ||
"attributes": { | ||
}, | ||
"conflicting": { | ||
}, | ||
"license": "Apache 2.0", | ||
"providing": { | ||
} | ||
} | ||
"license": "Apache 2.0", | ||
"conflicting": { | ||
|
||
}, | ||
"dependencies": { | ||
|
||
}, | ||
"providing": { | ||
"logrotate": [ | ||
|
||
] | ||
}, | ||
"long_description": "= DESCRIPTION:\n\nLogrotate configuration\n\n= REQUIREMENTS:\n\nDebian or Ubuntu preferred.\n\nRed Hat\/CentOS and Fedora can be used but will be converted to a Debian\/Ubuntu style Apache as it's far easier to manage with chef. \n\n= ATTRIBUTES:\n\n* none\n\nGeneral settings and prefork\/worker attributes are tunable.\n\n= USAGE:\n\ninclude the recipe and it will install a default logrotate, if you want it to do more however...\n\nmake a recipe such as,\n\nlogrotate_app \"chef\" do\n paths \"\/var\/log\/chef\/*.log\"\n rotate 4\nend\n\n== Defines:\n\n* logrotate_app:: sets up a logrotate configuration file\n\n= LICENSE & AUTHOR:\n\nAuthor:: Scott M. Likens (<scott@likens.us>)\nCopyright:: 2009, Scott M. Likens\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n", | ||
"description": "Installs logrotate", | ||
"replacing": { | ||
|
||
}, | ||
"platforms": { | ||
"debian": [ | ||
|
||
], | ||
"centos": [ | ||
|
||
], | ||
"ubuntu": [ | ||
|
||
], | ||
"redhat": [ | ||
|
||
] | ||
}, | ||
"version": "0.8.0", | ||
"recipes": { | ||
"logrotate": "" | ||
}, | ||
"maintainer": "Scott M. Likens", | ||
"recommendations": { | ||
|
||
}, | ||
"name": "logrotate", | ||
"maintainer_email": "scott@likens.us", | ||
"attributes": { | ||
|
||
}, | ||
"suggestions": { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<%= @paths %> { | ||
weekly | ||
missingok | ||
rotate <%= @rotate %> | ||
compress | ||
delaycompress | ||
copytruncate | ||
} | ||
|