Skip to content

Instantly share code, notes, and snippets.

@spuder
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spuder/239ddb45b168dc76bb31 to your computer and use it in GitHub Desktop.
Save spuder/239ddb45b168dc76bb31 to your computer and use it in GitHub Desktop.
logstash-server-puppet
node "logstash.foobar.com" {
class { 'ac_logstash_server':}
class { 'elasticsearch':
manage_repo => true,
repo_version => '1.0',
}
class { 'logstash':
autoupgrade => true,
restart_on_change => true,
manage_repo => true,
repo_version => '1.4',
}
# You must manually install kibana
# You should manually install kopf
}
The ac_logstash_server just manages the config files and makes sure the logstash user is present. Not really needed but makes my setup more failproof
```
class ac_logstash_server {
# Change /etc/syconfig/logstash START=no to START=true
# File location varries depending on OS
case $::osfamily {
RedHat:{
$logstash_config_location = '/etc/sysconfig/logstash'
}
Debian:{
$logstash_config_location = '/etc/default/logstash'
}
default:{
fail("${::osfamily} not supported yet")
}
}
user { 'logstash':
ensure => 'present',
comment => 'logstash',
home => '/opt/logstash',
password => '!!',
shell => '/sbin/nologin',
system => true
}
# Logstash daemon config
augeas { 'logstash-deamonize':
context => "/files/${logstash_config_location}/",
changes => "set START yes",
require => User['logstash'],
}
# Logstash config file
file { '/etc/logstash/conf.d/default.conf':
ensure => present,
content => template("ac_logstash_server/default.conf.erb"),
owner => 'logstash',
group => 'logstash',
require => User['logstash'],
}
# Verify the logs are writable by 'logstash'
file { '/var/log/logstash/logstash.log':
ensure => file,
owner => 'logstash',
group => 'root',
mode => 0644,
require => User['logstash'],
}
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment