Basic Logstash cookbook for Chef that installs Logstash from the official package repositories.
Tested on Ubuntu/Debian but should work on other platforms as well.
Just include the default recipe logstash::default
.
Put the following in your logstash server attributes:
{
"logstash": {
"version": "1.4",
"server": {
"enabled": true,
"inputs": [
{
"rabbitmq": {
"exchange": "rawlogs",
"user": "username",
"password": "verysecret",
"host": "rabbitmq.example.com",
"type": "all"
}
}
],
"outputs": [
{
"elasticsearch": {
"host": "elasticsearch.example.com",
"cluster": "logstash"
}
}
]
},
"agent": {
"inputs": [
{
"file": {
"path": ["/var/log/*.log"],
"exclude": ["*.gz"],
"type": "syslog"
}
}
],
"outputs": [
{
"rabbitmq": {
"host": "rabbitmq.example.com",
"port": "5672",
"user": "username",
"password": "verysecret",
"exchange": "logstash",
"exchange_type": "fanout"
}
}
]
}
}
}
And put this in your agents' attributes:
{
"logstash": {
"version": "1.4",
"agent": {
"inputs": [
{
file {
"path": ["/var/log/*.log"],
"exclude": ["*.gz"],
"type": "syslog"
}
}
],
"outputs": [
{
"rabbitmq": {
"host": "rabbitmq.example.com",
"port": "5672",
"user": "username",
"password": "verysecret",
"exchange": "logstash",
"exchange_type": "fanout"
}
}
]
}
}
}
node[:logstash][:version] = "1.4" # The version to install.
node[:logstash][:agent][:enabled] = true # Enable agent.
node[:logstash][:agent][:inputs] = [] # Inputs configuration, see http://logstash.net/docs/1.4.1/
node[:logstash][:agent][:outputs] = [] # Outputs configuration, see http://logstash.net/docs/1.4.1/
node[:logstash][:server][:enabled] = false # Enable server (default: false, agent only).
node[:logstash][:server][:inputs] = [] # Inputs configuration, see http://logstash.net/docs/1.4.1/
node[:logstash][:server][:outputs] = [] # Outputs configuration, see http://logstash.net/docs/1.4.1/
Meta recipe to install the packages and configure the server and/or agent.
Installs Logstash from the Debian packages.
Installs Logstash from the Yum repo packages.
Configures the agent.
Configures the server.
- https://github.com/lusis/chef-logstash where I borrowed the idea and even some code from.
Author:: Wouter de Vos - Springest ([email protected])