Version information
This version is compatible with:
- Puppet Enterprise >= 3.1.3
- Puppet >=2.7.20 <4.0.0
- , , , , , ,
This module has been deprecated by its author since Aug 6th 2018.
The author has suggested elastic-logstash as its replacement.
Start using this module
Documentation
puppet-logstash
A Puppet module for managing and configuring Logstash.
Versions
This overview shows you which Puppet module and Logstash version work together.
------------------------------------
| Puppet module | Logstash |
------------------------------------
| 0.0.1 - 0.1.0 | 1.1.9 |
------------------------------------
| 0.2.0 | 1.1.10 |
------------------------------------
| 0.3.0 - 0.3.4 | 1.1.12 - 1.1.13 |
------------------------------------
| 0.4.0 - 0.4.2 | 1.2.x - 1.3.x |
------------------------------------
| 0.5.0 | 1.4.x |
------------------------------------
Important notes
0.4.0
Please note that this a backwards compatability breaking release: in particular, the plugin syntax system has been removed entirely in favour of config files.
If you need any help please see the support section.
Requirements
- Puppet 2.7.x or better.
- The stdlib Puppet library.
- The file_concat Puppet library.
Optional:
- The apt Puppet library when using repo management on Debian/Ubuntu.
Usage Examples
The minimum viable configuration ensures that the service is running and that it will be started at boot time: N.B. you will still need to supply a configuration.
class { 'logstash': }
Specify a particular package (version) to be installed:
class { 'logstash':
version => '1.3.3-1_centos'
}
In the absense of an appropriate package for your environment it is possible to install from other sources as well.
http/https/ftp source:
class { 'logstash':
package_url => 'http://download.elasticsearch.org/logstash/logstash/packages/centos/logstash-1.3.3-1_centos.noarch.rpm'
}
puppet://
source:
class { 'logstash':
package_url => 'puppet:///path/to/logstash-1.3.3-1_centos.noarch.rpm'
}
Local file source:
class { 'logstash':
package_url => 'file:/path/to/logstash-1.3.3-1_centos.noarch.rpm'
}
Attempt to upgrade Logstash if a newer package is detected (false
by default):
class { 'logstash':
autoupgrade => true
}
Install everything but disable the service (useful for pre-configuring systems):
class { 'logstash':
status => 'disabled'
}
Under normal circumstances a modification to the Logstash configuration will trigger a restart of the service. This behaviour can be disabled:
class { 'logstash':
restart_on_change => false
}
Disable and remove Logstash entirely:
class { 'logstash':
ensure => 'absent'
}
Contrib package installation
As of Logstash 1.4.0 plugins have been split into 2 packages. To install the contrib package:
via the repository:
class { 'logstash':
install_contrib => true
}
via contrib_package_url:
class { 'logstash':
install_contrib => true,
contrib_package_install => 'package_url => 'http://download.elasticsearch.org/logstash/logstash/packages/centos/logstash-contrib-1.4.0-1_centos.noarch.rpm'
}
Configuration Overview
The Logstash configuration can be supplied as a single static file or dynamically built from multiple smaller files.
The basic usage is identical in either case: simply declare a file
attribute as you would the content
attribute of the file
type, meaning either direct content, template or a file resource:
logstash::configfile { 'configname':
content => template('path/to/config.file')
}
or
logstash::configfile { 'configname':
source => 'puppet:///path/to/config.file'
}
To dynamically build a configuration, simply declare the order
in which each section should appear - the lower the number the earlier it will appear in the resulting file (this should be a familiar idiom for most).
logstash::configfile { 'input_redis':
content => template('logstash/input_redis.erb'),
order => 10
}
logstash::configfile { 'filter_apache':
source => 'puppet:///path/to/filter_apache',
order => 20
}
logstash::configfile { 'output_es':
content => template('logstash/output_es_cluster.erb')
order => 30
}
Patterns
Many plugins (notably Grok) use patterns. While many are included in Logstash already, additional site-specific patterns can be managed as well; where possible, you are encouraged to contribute new patterns back to the community.
N.B. As of Logstash 1.2 the path to the additional patterns needs to be configured explicitly in the Grok configuration.
logstash::patternfile { 'extra_patterns':
source => 'puppet:///path/to/extra_pattern'
}
By default the resulting filename of the pattern will match that of the source. This can be over-ridden:
logstash::patternfile { 'extra_patterns_firewall':
source => 'puppet:///path/to/extra_patterns_firewall_v1',
filename => 'extra_patterns_firewall'
}
Plugins
Like the patterns above, Logstash comes with a large number of plugins; likewise, additional site-specific plugins can be managed as well. Again, where possible, you are encouraged to contribute new plugins back to the community.
logstash::plugin { 'myplugin':
ensure => 'present',
type => 'input',
source => 'puppet:///path/to/my/custom/plugin.rb'
}
By default the resulting filename of the plugin will match that of the source. This can be over-ridden:
logstash::plugin { 'myplugin':
ensure => 'present',
type => 'output',
source => 'puppet:///path/to/my/custom/plugin_v1.rb',
filename => 'plugin.rb'
}
Java Install
Most sites will manage Java seperately; however, this module can attempt to install Java as well.
class { 'logstash':
java_install => true
}
Specify a particular Java package (version) to be installed:
class { 'logstash':
java_install => true,
java_package => 'packagename'
}
Repository management
Most sites will manage repositories seperately; however, this module can manage the repository for you.
class { 'logstash':
manage_repo => true,
repo_version => '1.3'
}
Note: When using this on Debian/Ubuntu you will need to add the Puppetlabs/apt module to your modules.
Service Management
Currently only the basic SysV-style init service provider is supported but other systems could be implemented as necessary (pull requests welcome).
init
Defaults File
The defaults file (/etc/defaults/logstash
or /etc/sysconfig/logstash
) for the Logstash service can be populated as necessary. This can either be a static file resource or a simple key value-style hash object, the latter being particularly well-suited to pulling out of a data source such as Hiera.
file source
class { 'logstash':
init_defaults_file => 'puppet:///path/to/defaults'
}
hash representation
$config_hash = {
'LS_USER' => 'logstash',
'LS_GROUP' => 'logstash',
}
class { 'logstash':
init_defaults => $config_hash
}
Support
Need help? Join us in #logstash on Freenode IRC or subscribe to the logstash-users@googlegroups.com mailing list.
0.5.0 ( May 06, 2014 ) Move beaker testing to use docker Large module update to work with the contrib package Refactored rspec testing Fix inline docs Added Puppet 3.5.0 testing Fix typo in group name variable ( PR #147 ) Improve puppet module removal ( PR #149 ) Reverted PR #149. Caused issues with package removal. added lsbdistid = Debian to rspec facts ( PR #146 ) match other config perms with patterns ( PR #151 )
0.4.3 ( Feb 21, 2014 ) Lower puppetlabs-stdlib depdency from 4.0.0 to 3.2.0 Documentation improvements ( PR #132 #137 ) Fixed yumrepo call to include description ( PR #138 ) Added beaker testing Fixed bug that sometimes LS starts before all configs are processed. Ensure java is installed before installing the package when using package_url Fail fast when using package_url and repo config
0.4.2 ( Jan 31, 2014 ) Fix config directory for config files to be inline with the init file of the packages Update readme ( thanks to PR #130 from phrawzty ) Added repo management ( based on work of PR #121 from pcfens )
0.4.1 ( Jan 23, 2014 ) Important Update Ensure exec names are unique. This caused an issue when using the Elasticsearch Puppet module Removed a part in the package.pp that should have been removed ( missed with the rewrite ) Missed a few bits of the rewrite. Updated readme to reflect reality regarding configfile define.
0.4.0 ( Jan 21, 2014 ) NOTE: This is a backwards compability breaking release !! Large rewrite of the entire module described below Make the core more dynamic for different service providers Add better testing and devided into different files Add different ways to install the package except from the repository ( puppet/http/https/ftp/file ) Update java class to install openjdk 1.7 Add validation of templates Added more test scenario's Added puppet parser validate task for added checking Improve module removing when set to absent Updated readme Doc improvements by dan ( phrawzty ) Added define for managing pattern files Added define for managing plugins
0.3.4 ( Oct 14, 2013 ) Fixing purging of created directories ( PR #61, #64 by Kayla Green and Jason Koppe ) Documentation fixes ( PR #65, #67 by Kristian Glass and Andreas Paul ) Making config dir configurable ( PR #70 by Justin Lambert ) Permit HTTP(s) for downloading logstash ( PR #71 by Phil Fenstermacher ) Ensure user/group is passed in the debian init file Spec cleanup ( PR #75 by Justin Lambert ) set logstash logdir perms when using custom jar provider ( PR #74 by Justin Lambert ) clean up installpath when updating jars ( PR #72 by Justin Lambert ) fix wrong creates path at jar custom provider ( PR #83 by Daniel Werdermann ) added 'in progress' for logstash version 1.2.x ( PR #87 by rtoma ) Add small input/output examples ( PR #89 by Andreas Paul ) Solving defaults file not being installed in some cases http download of jar should require $jardir ( PR #90 by Max Griffiths ) add ability to install a logstash config file ( PR #93 by Justin Lambert )
0.3.3 ( Jun 15, 2013 ) Enable puppet 3.2.x testing Fix issue that the config dir was missing in the init files Fix variable access deprecation warning ( PR #56 by Richard Peng )
0.3.2 ( May 23, 2013 ) Fixing issue when using jar file without multi-instance feature Added rspec tests to cover this issue
0.3.1 ( May 15, 2013 ) Missed changes for enabling/disabling multi-instance feature Adding a few spec tests for the multi-instance feature
0.3.0 ( May 09, 2013 ) Update defines for Logstash 1.1.12 Adding license file Deleted old init file removal to avoid issues. ( Issue #50 ) Allow file owner/group to be variable ( Issue/PR #47 ) Ensure log directory exists before starting ( PR #53 by Brian Lalor ) Provide complete containment of the class ( PR #53 by Brian Lalor ) Update rspec tests for new defines
0.2.0 ( Apr 30, 2013 ) Update defines for logstash 1.1.10 New feature for plugins to automatically transfer files ( Issue #24 ) Create correct tmp dir ( Issue #35 ) Change file modes to be more secure ( Issue #36 ) Update defines for better input validation ( Issue #43 ) Adding rspec tests for plugin defines Fix tmp dir Debian init script ( PR #44 by Dan Carley )
0.1.0 ( Mar 25, 2013 ) Don't backup the Jar file or the symlink ( Issue #25 by Garth Kidd ) First implementation of the multi-instance feature. This will break certain functionality.
0.0.6 ( Mar 07, 2013 ) Fix issue that the init file was overwritten Ensure we install java first before starting logstash if enabled
0.0.5 ( Mar 02, 2013 ) Adding spec tests Update Readme ( PR #20 by rjw1 ) New feature to install java
0.0.4 ( Feb 10, 2013 ) Rename Redhat to RedHat for init file ( PR #12 by pkubat ) Adding Amazon as Operating system ( PR #12 by pkubat ) Symlinking Jar file to generic name ( PR #12 by pkubat ) Correting symlink ( PR #14 by Jeff Wong )
0.0.3 ( Feb 5, 2013 ) Clarify jarfile usage and validation ( PR #6 by Garth Kidd ) Add default Debian Init script when non provided and using custom source ( PR #7 by Garth Kidd ) Add RedHat as OS type ( PR #8 by Dan ) Skip init script when status = unmanaged ( PR #9 by Tavis Aitken ) Refactored the custom provider part ( With help of Garth Kidd )
0.0.2 ( Jan 19, 2013 ) Adding a way to provide jar and init file instead of depending on a package
0.0.1 ( Jan 13, 2013 ) Initial release of the module
Dependencies
- puppetlabs/stdlib (>= 3.2.0)
- ispavailability/file_concat (>= 0.1.0)
Copyright (c) 2012-2014 Elasticsearch <http://www.elasticsearch.org> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.