This repository has been archived by the owner on Jun 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
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
4 changed files
with
95 additions
and
25 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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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!). |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,5 @@ | |||
service "loggly" do | |||
supports :start => true, :stop => true | |||
running false | |||
action [ :enable, :start ] | |||
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