Skip to content

Commit

Permalink
rsyslog v0.99.0
Browse files Browse the repository at this point in the history
* consolidate ubuntu rules config
* use a PPA to install rsyslog from lucid on hardy
  • Loading branch information
jtimberman committed Feb 17, 2011
1 parent 94252da commit 43bfe55
Show file tree
Hide file tree
Showing 10 changed files with 111 additions and 155 deletions.
70 changes: 70 additions & 0 deletions rsyslog/README.md
@@ -0,0 +1,70 @@
DESCRIPTION
===========

Installs rsyslog to replace sysklogd for client and/or server use. By default, server will be set up to log to files.

REQUIREMENTS
============

Platform
--------

Tested on Ubuntu 8.04, 9.10, 10.04.

For Ubuntu 8.04, the rsyslog package will be installed from a PPA via the default.rb recipe in order to get 4.2.0 backported from 10.04.

* https://launchpad.net/~a.bono/+archive/rsyslog

Ubuntu 8.10 and 9.04 are no longer supported releases and have not been tested with this cookbook.

Cookbooks
---------

* cron (http://cookbooks.opscode.com/cookbooks/cron)

ATTRIBUTES
==========

* `rsyslog[:log_dir]` - specify the directory to store logs (applicable to server only), default /srv/rsyslog
* `rsyslog[:server]` - specify the remote rsyslog server. default false (no remote server)
* `rsyslog[:protocol]` - specify whether to use udp or tcp for remote log transmission. tcp is default.

USAGE
=====

To replace the sysklogd syslog service with rsyslog:

include_recipe "rsyslog"

To set up a client with a remote [r]syslog server:

include_recipe "rsyslog::client"

By default, this cookbook will use TCP so the server should be configured for TCP. This can be done easily with the server recipe:

include_recipe "rsyslog::server"

To switch to UDP, change the rsyslog[:protocol] attribute. Note this needs to be done on each client as well.

Also, the server configuration will set up `log_dir` for each client, by date. Structure:

<%= @log_dir %>/YEAR/MONTH/DAY/HOSTNAME/"logfile"

LICENSE AND AUTHOR
==================

Author:: Joshua Timberman (<joshua@opscode.com>)

Copyright:: 2009-2011, Opscode, Inc

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.
57 changes: 0 additions & 57 deletions rsyslog/README.rdoc

This file was deleted.

8 changes: 4 additions & 4 deletions rsyslog/metadata.json
@@ -1,13 +1,13 @@
{
"name": "rsyslog",
"description": "Installs and configures rsyslog",
"long_description": "= DESCRIPTION:\n\nInstalls rsyslog to replace sysklogd for client and/or server use. By default, server will be set up to log to files.\n\n= REQUIREMENTS:\n\n== Platform:\n\nTested on Ubuntu 8.10.\n\n== Cookbooks:\n\n* 'cron'.\n\n= ATTRIBUTES: \n\n* rsyslog[:log_dir] - specify the directory to store logs (applicable to server only)\n* rsyslog[:server] - specify the remote rsyslog server.\n* rsyslog[:protocol] - specify whether to use udp or tcp for remote log transmission. tcp is default.\n\n= USAGE:\n\nTo replace the sysklogd syslog service with rsyslog:\n\n include_recipe \"rsyslog\"\n \nTo set up a client with a remote [r]syslog server:\n\n include_recipe \"rsyslog::client\"\n \nBy default, this cookbook will use TCP so the server should be configured for TCP. This can be done easily with the server recipe:\n\n include_recipe \"rsyslog::server\"\n\nTo switch to UDP, change the rsyslog[:protocol] attribute. Note this needs to be done on each client as well.\n\nAlso, the server configuration will set up log_dir for each client, by date. Structure:\n\n <%= @log_dir %>/YEAR/MONTH/DAY/HOSTNAME/\"logfile\"\n\n= LICENSE and AUTHOR:\n \nAuthor:: Joshua Timberman (<joshua@opscode.com>)\n\nCopyright:: 2009, Opscode, Inc\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",
"long_description": "DESCRIPTION\n===========\n\nInstalls rsyslog to replace sysklogd for client and/or server use. By default, server will be set up to log to files.\n\nREQUIREMENTS\n============\n\nPlatform\n--------\n\nTested on Ubuntu 8.04, 9.10, 10.04.\n\nFor Ubuntu 8.04, the rsyslog package will be installed from a PPA via the default.rb recipe in order to get 4.2.0 backported from 10.04.\n\n* https://launchpad.net/~a.bono/+archive/rsyslog\n\nUbuntu 8.10 and 9.04 are no longer supported releases and have not been tested with this cookbook.\n\nCookbooks\n---------\n\n* cron (http://cookbooks.opscode.com/cookbooks/cron)\n\nATTRIBUTES\n==========\n\n* `rsyslog[:log_dir]` - specify the directory to store logs (applicable to server only), default /srv/rsyslog\n* `rsyslog[:server]` - specify the remote rsyslog server. default false (no remote server)\n* `rsyslog[:protocol]` - specify whether to use udp or tcp for remote log transmission. tcp is default.\n\nUSAGE\n=====\n\nTo replace the sysklogd syslog service with rsyslog:\n\n include_recipe \"rsyslog\"\n\nTo set up a client with a remote [r]syslog server:\n\n include_recipe \"rsyslog::client\"\n\nBy default, this cookbook will use TCP so the server should be configured for TCP. This can be done easily with the server recipe:\n\n include_recipe \"rsyslog::server\"\n\nTo switch to UDP, change the rsyslog[:protocol] attribute. Note this needs to be done on each client as well.\n\nAlso, the server configuration will set up `log_dir` for each client, by date. Structure:\n\n <%= @log_dir %>/YEAR/MONTH/DAY/HOSTNAME/\"logfile\"\n\nLICENSE AND AUTHOR\n==================\n\nAuthor:: Joshua Timberman (<joshua@opscode.com>)\n\nCopyright:: 2009-2011, Opscode, Inc\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",
"maintainer": "Opscode, Inc.",
"maintainer_email": "cookbooks@opscode.com",
"license": "Apache 2.0",
"platforms": {
"ubuntu": [
">= 8.10"
">= 8.04"
],
"debian": [
">= 5.0"
Expand Down Expand Up @@ -92,5 +92,5 @@
"rsyslog::client": "Sets up a client to log to a remote rsyslog server",
"rsyslog::server": "Sets up an rsyslog server"
},
"version": "0.9.5"
}
"version": "0.99.0"
}
6 changes: 3 additions & 3 deletions rsyslog/metadata.rb
Expand Up @@ -2,14 +2,14 @@
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "Installs and configures rsyslog"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
version "0.9.5"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.99.0"

recipe "rsyslog", "Installs rsyslog"
recipe "rsyslog::client", "Sets up a client to log to a remote rsyslog server"
recipe "rsyslog::server", "Sets up an rsyslog server"

supports "ubuntu", ">= 8.10"
supports "ubuntu", ">= 8.04"
supports "debian", ">= 5.0"

depends "cron"
Expand Down
29 changes: 19 additions & 10 deletions rsyslog/recipes/default.rb
Expand Up @@ -17,6 +17,18 @@
# limitations under the License.
#

if platform?("ubuntu") && node[:platform_version].to_f == 8.04
apt_repository "hardy-rsyslog-ppa" do
uri "http://ppa.launchpad.net/a.bono/rsyslog/ubuntu"
distribution "hardy"
components ["main"]
keyserver "keyserver.ubuntu.com"
key "C0061A4A"
action :add
notifies :run, "execute[apt-get update]", :immediately
end
end

package "rsyslog" do
action :install
end
Expand Down Expand Up @@ -47,15 +59,12 @@
notifies :restart, resources(:service => "rsyslog"), :delayed
end

case node[:platform]
when "ubuntu"
if node[:platform_version].to_f >= 9.10
template "/etc/rsyslog.d/50-default.conf" do
source "50-default.conf.erb"
backup false
owner "root"
group "root"
mode 0644
end
if platform?("ubuntu")
template "/etc/rsyslog.d/50-default.conf" do
source "50-default.conf.erb"
backup false
owner "root"
group "root"
mode 0644
end
end
21 changes: 13 additions & 8 deletions rsyslog/recipes/server.rb
Expand Up @@ -2,7 +2,7 @@
# Cookbook Name:: rsyslog
# Recipe:: server
#
# Copyright 2009, Opscode, Inc.
# Copyright 2009-2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -22,6 +22,10 @@

node.set[:rsyslog][:server] = true

unless Chef::Config[:solo]
node.save
end

directory node[:rsyslog][:log_dir] do
owner "root"
group "root"
Expand All @@ -31,7 +35,10 @@
template "/etc/rsyslog.d/server.conf" do
source "server.conf.erb"
backup false
variables :log_dir => node[:rsyslog][:log_dir], :protocol => node[:rsyslog][:protocol]
variables(
:log_dir => node[:rsyslog][:log_dir],
:protocol => node[:rsyslog][:protocol]
)
owner "root"
group "root"
mode 0644
Expand All @@ -45,10 +52,8 @@
only_if do ::File.exists?("/etc/rsyslog.d/remote.conf") end
end

template "/etc/cron.d/rsyslog_gz" do
source "rsyslog_gz.erb"
owner "root"
group "root"
mode 0644
variables :log_dir => node[:rsyslog][:log_dir]
cron "rsyslog_gz" do
command "find #{node[:rsyslog][:log_dir]}/$(date +\%Y) -type f -mtime +1 -exec gzip -q {} \;"
minute "0"
hour "4"
end
4 changes: 2 additions & 2 deletions rsyslog/templates/default/rsyslog.conf.erb
Expand Up @@ -43,7 +43,7 @@ $FileCreateMode 0640
#
$IncludeConfig /etc/rsyslog.d/*.conf


<% unless node[:platform] == 'ubuntu' -%>
###############
#### RULES ####
###############
Expand Down Expand Up @@ -112,4 +112,4 @@ daemon.*;mail.*;\
news.err;\
*.=debug;*.=info;\
*.=notice;*.=warn |/dev/xconsole

<% end -%>
2 changes: 0 additions & 2 deletions rsyslog/templates/default/rsyslog_gz.erb

This file was deleted.

69 changes: 0 additions & 69 deletions rsyslog/templates/ubuntu-9.10/50-default.conf.erb

This file was deleted.

0 comments on commit 43bfe55

Please sign in to comment.