Commit 9e863746 authored by jtimberman's avatar jtimberman
Browse files

release v1.1.0

Also add per-host attribute per ticket comment
parent 32069b8a
## v1.1.0:
Changes from COOK-1167:
* More versatile server discovery - use the IP as an attribute, or use
search (see README)
* Removed cron dependency.
* Removed log archival; logrotate is recommended.
* Add an attribute to select the per-host directory in the log dir
* Works with Chef Solo now.
* Set debian/ubuntu default user and group. Drop privileges to `syslog.adm`.
## v1.0.0:
* [COOK-836] - use an attribute to specify the role to search for
......
......@@ -3,24 +3,10 @@ Description
Installs rsyslog to replace sysklogd for client and/or server use. By default, server will be set up to log to files.
Changes
=======
## v1.0.1:
* More versitile server resolving mechanism. Now server's ip can be set
explicitly or the search operation can be used instead.
* Removed cron dependency.
* Removed log archivation.
* Works with ChefSolo now.
* Set debian/ubuntu default user and group. Drop privileges to `syslog.adm`.
## v1.0.0:
* [COOK-836] - use an attribute to specify the role to search for
instead of relying on the rsyslog['server'] attribute.
* Clean up attribute usage to use strings instead of symbols.
* Update this README.
* Better handling for chef-solo.
**Important Changes in 1.1.0**: See the CHANGELOG.md file for
important changes to this cookbook. There are some incompatibilities
with existing installations. Use version 1.0.0 if you're not ready
for these changes.
Requirements
============
......@@ -61,7 +47,11 @@ See `attributes/default.rb` for default values.
* `node['rsyslog']['port']` - Specify the port which rsyslog should
connect to a remote loghost.
* `node['rsyslog']['remote_logs']` - Specify wether to send all logs
to a remote server (client option). Default is `true`;
to a remote server (client option). Default is `true`.
* `node['rsyslog']['per_host_dir']` - "PerHost" directories for
template statements in `35-server-per-host.conf`. Default value is
the previous cookbook version's value, to preserve compatibility.
See __server__ recipe below.
Recipes
......@@ -96,17 +86,30 @@ so that client nodes can find it with search. This recipe will create the logs i
`node['rsyslog']['log_dir']`, and the configuration is in
`/etc/rsyslog.d/server.conf`. This recipe also removes any previous
configuration to a remote server by removing the
`/etc/rsyslog.d/remote.conf` file. Finally, a cron job is set up to
compress logs in the `log_dir` that are older than one day.
`/etc/rsyslog.d/remote.conf` file.
The cron job used in the previous version of this cookbook is removed,
but it does not remove any existing cron job from your system (so it
doesn't break anything unexpectedly). We recommend setting up
logrotate for the logfiles instead.
The `log_dir` will be concatenated with `per_host_dir` to store the
logs for each client. Modify the attribute to have a value that is
allowed by rsyslogs template matching values, see the rsyslog
documentation for this.
The server configuration will set up `log_dir` for each client.
Directory structure:
<%= @log_dir %>/HOSTNAME/"logfile"
<%= @log_dir %>/<%= @per_host_dir %>/"logfile"
For example for the system with hostname `www`:
For example:
/srv/rsyslog/2011/11/19/www/messages
/srv/rsyslog/www/messages
For example, to change this to just the hostname, set the attribute
`node['rsyslog']['per_host_dir']` via a role:
"rsyslog" => { "per_host_dir" => "%HOSTNAME%" }
At this time, the server can only listen on UDP *or* TCP.
......@@ -127,6 +130,7 @@ graylog2, logstash, etc), you can still send log messages to it as
long as the port and protocol match up with the server
software. See __Examples__
Examples
--------
......@@ -150,6 +154,14 @@ If you want to specify another syslog compatible server with a role other
than loghost, simply fill free to use the `server_ip` attribute or
the `server_search` attribute.
Example role that sets the per host directory:
name "loghost"
description "Central syslog server"
run_list("recipe[rsyslog::server]")
default_attributes(
"rsyslog" => { "per_host_dir" => "%HOSTNAME%" }
)
License and Author
==================
......
......@@ -24,3 +24,4 @@ default["rsyslog"]["port"] = "514"
default["rsyslog"]["server_ip"] = nil
default["rsyslog"]["server_search"] = "role:loghost"
default["rsyslog"]["remote_logs"] = true
default["rsyslog"]["per_host_dir"] = "%$YEAR%/%$MONTH%/%$DAY%/%HOSTNAME%"
......@@ -3,7 +3,7 @@ maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "Installs and configures rsyslog"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "1.0.1"
version "1.1.0"
recipe "rsyslog", "Installs rsyslog"
recipe "rsyslog::client", "Sets up a client to log to a remote rsyslog server"
......
......@@ -38,7 +38,10 @@ end
template "/etc/rsyslog.d/35-server-per-host.conf" do
source "35-server-per-host.conf.erb"
backup false
variables(:log_dir => node['rsyslog']['log_dir'])
variables(
:log_dir => node['rsyslog']['log_dir'],
:per_host_dir => node['rsyslog']['per_host_dir']
)
owner "root"
group "root"
mode 0644
......
......@@ -5,22 +5,22 @@ $DirGroup adm
$DirCreateMode 0755
$FileGroup adm
$template PerHostAuth,"<%= @log_dir %>/%HOSTNAME%/auth.log"
$template PerHostCron,"<%= @log_dir %>/%HOSTNAME%/cron.log"
$template PerHostSyslog,"<%= @log_dir %>/%HOSTNAME%/syslog"
$template PerHostDaemon,"<%= @log_dir %>/%HOSTNAME%/daemon.log"
$template PerHostKern,"<%= @log_dir %>/%HOSTNAME%/kern.log"
$template PerHostLpr,"<%= @log_dir %>/%HOSTNAME%/lpr.log"
$template PerHostUser,"<%= @log_dir %>/%HOSTNAME%/user.log"
$template PerHostMail,"<%= @log_dir %>/%HOSTNAME%/mail.log"
$template PerHostMailInfo,"<%= @log_dir %>/%HOSTNAME%/mail.info"
$template PerHostMailWarn,"<%= @log_dir %>/%HOSTNAME%/mail.warn"
$template PerHostMailErr,"<%= @log_dir %>/%HOSTNAME%/mail.err"
$template PerHostNewsCrit,"<%= @log_dir %>/%HOSTNAME%/news.crit"
$template PerHostNewsErr,"<%= @log_dir %>/%HOSTNAME%/news.err"
$template PerHostNewsNotice,"<%= @log_dir %>/%HOSTNAME%/news.notice"
$template PerHostDebug,"<%= @log_dir %>/%HOSTNAME%/debug"
$template PerHostMessages,"<%= @log_dir %>/%HOSTNAME%/messages"
$template PerHostAuth,"<%= @log_dir %>/<%= @per_host_dir %>/auth.log"
$template PerHostCron,"<%= @log_dir %>/<%= @per_host_dir %>/cron.log"
$template PerHostSyslog,"<%= @log_dir %>/<%= @per_host_dir %>/syslog"
$template PerHostDaemon,"<%= @log_dir %>/<%= @per_host_dir %>/daemon.log"
$template PerHostKern,"<%= @log_dir %>/<%= @per_host_dir %>/kern.log"
$template PerHostLpr,"<%= @log_dir %>/<%= @per_host_dir %>/lpr.log"
$template PerHostUser,"<%= @log_dir %>/<%= @per_host_dir %>/user.log"
$template PerHostMail,"<%= @log_dir %>/<%= @per_host_dir %>/mail.log"
$template PerHostMailInfo,"<%= @log_dir %>/<%= @per_host_dir %>/mail.info"
$template PerHostMailWarn,"<%= @log_dir %>/<%= @per_host_dir %>/mail.warn"
$template PerHostMailErr,"<%= @log_dir %>/<%= @per_host_dir %>/mail.err"
$template PerHostNewsCrit,"<%= @log_dir %>/<%= @per_host_dir %>/news.crit"
$template PerHostNewsErr,"<%= @log_dir %>/<%= @per_host_dir %>/news.err"
$template PerHostNewsNotice,"<%= @log_dir %>/<%= @per_host_dir %>/news.notice"
$template PerHostDebug,"<%= @log_dir %>/<%= @per_host_dir %>/debug"
$template PerHostMessages,"<%= @log_dir %>/<%= @per_host_dir %>/messages"
auth,authpriv.* ?PerHostAuth
*.*;auth,authpriv.none -?PerHostSyslog
......
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