Commit 5961f7f7 authored by jtimberman's avatar jtimberman
Browse files

rsyslog v0.99.0

* consolidate ubuntu rules config
* use a PPA to install rsyslog from lucid on hardy
parent 121a42ac
= DESCRIPTION:
DESCRIPTION
===========
Installs rsyslog to replace sysklogd for client and/or server use. By default, server will be set up to log to files.
= REQUIREMENTS:
REQUIREMENTS
============
== Platform:
Platform
--------
Tested on Ubuntu 8.10.
Tested on Ubuntu 8.04, 9.10, 10.04.
== Cookbooks:
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.
* 'cron'.
* https://launchpad.net/~a.bono/+archive/rsyslog
= ATTRIBUTES:
Ubuntu 8.10 and 9.04 are no longer supported releases and have not been tested with this cookbook.
* rsyslog[:log_dir] - specify the directory to store logs (applicable to server only)
* rsyslog[:server] - specify the remote rsyslog server.
* rsyslog[:protocol] - specify whether to use udp or tcp for remote log transmission. tcp is default.
Cookbooks
---------
= USAGE:
* 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"
include_recipe "rsyslog"
To set up a client with a remote [r]syslog server:
include_recipe "rsyslog::client"
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"
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:
Also, the server configuration will set up `log_dir` for each client, by date. Structure:
<%= @log_dir %>/YEAR/MONTH/DAY/HOSTNAME/"logfile"
<%= @log_dir %>/YEAR/MONTH/DAY/HOSTNAME/"logfile"
LICENSE AND AUTHOR
==================
= LICENSE and AUTHOR:
Author:: Joshua Timberman (<joshua@opscode.com>)
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.
......
{
"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"
......@@ -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"
}
\ No newline at end of file
......@@ -2,14 +2,14 @@ maintainer "Opscode, Inc."
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"
......
......@@ -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
......@@ -47,15 +59,12 @@ template "/etc/rsyslog.conf" do
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
......@@ -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.
......@@ -22,6 +22,10 @@ include_recipe "rsyslog"
node.set[:rsyslog][:server] = true
unless Chef::Config[:solo]
node.save
end
directory node[:rsyslog][:log_dir] do
owner "root"
group "root"
......@@ -31,7 +35,10 @@ end
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
......@@ -45,10 +52,8 @@ file "/etc/rsyslog.d/remote.conf" do
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
......@@ -43,7 +43,7 @@ $FileCreateMode 0640
#
$IncludeConfig /etc/rsyslog.d/*.conf
<% unless node[:platform] == 'ubuntu' -%>
###############
#### RULES ####
###############
......@@ -112,4 +112,4 @@ daemon.*;mail.*;\
news.err;\
*.=debug;*.=info;\
*.=notice;*.=warn |/dev/xconsole
<% end -%>
# Chef Name: rsyslog_gz
0 4 * * * find <%= @log_dir %>/$(date +\%Y) -type f -mtime +1 -exec gzip -q {} \;
# Default rules for rsyslog.
#
# For more information see rsyslog.conf(5) and /etc/rsyslog.conf
#
# First some standard log files. Log by facility.
#
auth,authpriv.* /var/log/auth.log
*.*;auth,authpriv.none -/var/log/syslog
#cron.* /var/log/cron.log
daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
lpr.* -/var/log/lpr.log
mail.* -/var/log/mail.log
user.* -/var/log/user.log
#
# Logging for the mail system. Split it up so that
# it is easy to write scripts to parse these files.
#
mail.info -/var/log/mail.info
mail.warn -/var/log/mail.warn
mail.err /var/log/mail.err
#
# Logging for INN news system.
#
news.crit /var/log/news/news.crit
news.err /var/log/news/news.err
news.notice -/var/log/news/news.notice
#
# Some "catch-all" log files.
#
*.=debug;\
auth,authpriv.none;\
news.none;mail.none -/var/log/debug
*.=info;*.=notice;*.=warn;\
auth,authpriv.none;\
cron,daemon.none;\
mail,news.none -/var/log/messages
#
# Emergencies are sent to everybody logged in.
#
*.emerg *
#
# I like to have messages displayed on the console, but only on a virtual
# console I usually leave idle.
#
#daemon,mail.*;\
# news.=crit;news.=err;news.=notice;\
# *.=debug;*.=info;\
# *.=notice;*.=warn /dev/tty8
# The named pipe /dev/xconsole is for the `xconsole' utility. To use it,
# you must invoke `xconsole' with the `-file' option:
#
# $ xconsole -file /dev/xconsole [...]
#
# NOTE: adjust the list below, or you'll go crazy if you have a reasonably
# busy site..
#
daemon.*;mail.*;\
news.err;\
*.=debug;*.=info;\
*.=notice;*.=warn |/dev/xconsole
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment