Permalink
Browse files

Update/document loggly recipe.

  • Loading branch information...
1 parent 2254d93 commit e1eaaeb934a00d966bf5a3a3d248dda816ebeeff @till committed Jul 4, 2012
Showing with 95 additions and 25 deletions.
  1. +67 −0 loggly/README.md
  2. +20 −0 loggly/recipes/scalarium.rb
  3. +5 −0 loggly/recipes/service.rb
  4. +3 −25 loggly/recipes/setup.rb
View
@@ -0,0 +1,67 @@
+# loggly
+
+## Requirements
+
+ * Ubuntu
+ * Ruby (in `/usr/local/bin`)
+ * rsyslog
+ * [loggly](http://loggly.com) (syslog (TCP) input)
+
+## Usage
+
+Add this to your runlist: `loggly::setup`
+
+## How does it work?
+
+We hope it's pretty simple and straight forward:
+
+ * we write a configuration for rsyslog to send all data to loggly
+ * each instance gets a `loggly` init-script, which is customized with necessary variables: user, password, ...)
+ * we install a script called `deviceid` (called from the init script)
+ * init-script is ran during boot process and shutdown
+
+## Customization (aka attribute files)
+
+Edit the `attributes/default.rb` or read on.
+
+If you happen to use Scalarium, edit your _cloud json_ via the cloud overview, then actions and edit cloud.
+
+### loggly
+
+Set the following in your `node.json`:
+
+ {
+ "loggly": {
+ "domain": "example",
+ "input": 1,
+ "user": "account",
+ "pass": "password"
+ }
+ }
+
+Domain is your _subdomain_, e.g. http://example.loggly.com.
+
+### rsyslog
+
+So, yeah - this recipe uses the syslog (TCP) transport only.
+
+For rsyslog's configuration, we have a few options as well:
+
+ {
+ "syslog": {
+ "logfiles": {
+ "/var/log/nginx/error.log": "error",
+ "/var/log/php/slow.log" => "notice"
+ "/var/log/php/fpm.log" => "error"
+ },
+ "host": "logs.loggly.com",
+ "haproxy": {
+ "log_dir": "/mnt/logs/haproxy",
+ "poll": 10
+ }
+ }
+ }
+
+`logfiles` should be interesting since this allows us to configure rsyslog to pick up logfiles as well.
+
+The haproxy-related bits are Scalarium specific. We should probably spin this off some time (PRs welcome!).
@@ -0,0 +1,20 @@
+# this is specific to our setup and is only triggered on scalarium
+if node[:scalarium]
+ if node[:scalarium][:instance][:roles].include?('loadbalancer')
+
+ template "/etc/rsyslog.d/10-haproxy.conf" do
+ source "10-haproxy.conf.erb"
+ mode "0644"
+ end
+
+ directory "#{node[:syslog][:haproxy][:log_dir]}" do
+ recursive true
+ mode "0755"
+ end
+
+ service "rsyslog" do
+ supports :status => true, :restart => true, :reload => true
+ action [ :restart ]
+ end
+ end
+end
@@ -0,0 +1,5 @@
+service "loggly" do
+ supports :start => true, :stop => true
+ running false
+ action [ :enable, :start ]
+end
View
@@ -1,6 +1,7 @@
gem_package "json"
if node[:loggly] && (node[:loggly][:domain] != 'example')
+
template "/etc/rsyslog.d/10-loggly.conf" do
source "10-loggly.conf.erb"
mode "0644"
@@ -22,28 +23,5 @@
end
end
-if node[:scalarium]
- if node[:scalarium][:instance][:roles].include?('loadbalancer')
-
- template "/etc/rsyslog.d/10-haproxy.conf" do
- source "10-haproxy.conf.erb"
- mode "0644"
- end
-
- directory "#{node[:syslog][:haproxy][:log_dir]}" do
- recursive true
- mode "0755"
- end
-
- service "rsyslog" do
- supports :status => true, :restart => true, :reload => true
- action [ :restart ]
- end
- end
-end
-
-service "loggly" do
- supports :start => true, :stop => true
- running false
- action [ :enable, :start ]
-end
+include_recipe "loggly::scalarium"
+include_recipe "loggly::service"

0 comments on commit e1eaaeb

Please sign in to comment.