Version information
This version is compatible with:
- Puppet Enterprise >= 3.2.0 <5.0.0
- Puppet >=3.2.0 <5.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
elasticsearch/logstash
Legacy module for managing Logstash 2.x.
This module is no longer under active development. See below...
Deprecation warning
This version of the module only supports Logstash 2.x.
- It is available on Puppet Forge as "
elasticsearch/logstash
". - The source is kept on the
2.x
branch of the GitHub repository.
For Logstash 5.x, and a better experience in general, a heavily rewritten module is available:
- On Puppet Forge as "
elastic/logstash
". - In the
master
branch of the GitHub repository.
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 - 0.5.1 | 1.4.1 - 1.4.2 |
------------------------------------
| 0.6.x | 1.5.0 - 2.x |
------------------------------------
Requirements
- Puppet 3.2.0 or better.
- The stdlib Puppet library.
- The electrical/file_concat Puppet library.
Optional:
- The apt (>= 2.0.0) Puppet library when using repo management on Debian/Ubuntu.
- The zypprepo Puppet library when using repo management on SLES/SuSE
Quick Start
This minimum viable configuration ensures that the service is running and that it will be started at boot time.
class { 'logstash':
manage_repo => true,
java_install => true,
}
# It is essential to provide a valid Logstash configuration file for the daemon to start.
logstash::configfile { 'my_ls_config':
content => template('path/to/config.file'),
}
Package and service options
Choosing a Logstash minor version
class { 'logstash':
manage_repo => true,
repo_version => '1.4',
}
Using an explicit package source
Rather than use your distribution's repository system, you can specify an explicit package to fetch and install.
From an HTTP/HTTPS/FTP URL
class { 'logstash':
package_url => 'http://download.elasticsearch.org/logstash/logstash/packages/centos/logstash-1.3.3-1_centos.noarch.rpm',
}
From a 'puppet://' URL
class { 'logstash':
package_url => 'puppet:///modules/my_module/logstash-1.3.3-1_centos.noarch.rpm',
}
From a local file on the agent
class { 'logstash':
package_url => 'file:///tmp/logstash-1.3.3-1_centos.noarch.rpm',
}
Allow automatic point-release upgrades
class { 'logstash':
manage_repo => true,
repo_version => '1.5',
autoupgrade => true,
}
Do not run as a daemon
class { 'logstash':
status => 'disabled',
}
Disable automatic restarts
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
class { 'logstash':
ensure => 'absent',
}
Logstash config files
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',
}
If you want to use hiera to specify your configs, include the following create_resources call in your node manifest or in manifests/site.pp:
$logstash_configs = hiera('logstash_configs', {})
create_resources('logstash::configfile', $logstash_configs)
...and then include the following config within the corresponding hiera file:
"logstash_configs": {
"config-name": {
"template": "logstash/config.file.erb",
}
}
Please note you'll have to create your logstash.conf.erb file and place it in the logstash module templates directory prior to using this method
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':
template => 'logstash/input_redis.erb',
order => 10,
}
logstash::configfile { 'filter_apache':
source => 'puppet:///path/to/filter_apache',
order => 20,
}
logstash::configfile { 'output_es':
template => 'logstash/output_es_cluster.erb',
order => 30,
}
Inline Logstash config
For simple cases, it's possible to provide your Logstash config as an inline string:
logstash::configfile { 'basic_ls_config':
content => 'input { tcp { port => 2000 } } output { null {} }',
}
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',
}
IMPORTANT NOTE: Using logstash::patternfile places new patterns in the correct directory, however, it does NOT cause the path to be included automatically for filters (example: grok filter). You will still need to include this path (by default, /etc/logstash/patterns/) explicitly in your configurations.
Example: If using 'grok' in one of your configurations, you must include the pattern path in each filter like this:
# Note: this example is Logstash configuration, not a Puppet resource.
# Logstash and Puppet look very similar!
grok {
patterns_dir => "/etc/logstash/patterns/"
...
}
Plugin management
Installing by name (from RubyGems.org)
logstash::plugin { 'logstash-input-beats': }
Installing from a local Gem
logstash::plugin { 'logstash-input-custom':
source => '/tmp/logstash-input-custom-0.1.0.gem',
}
Installing from a 'puppet://' URL
logstash::plugin { 'logstash-filter-custom':
source => 'puppet:///modules/my_ls_module/logstash-filter-custom-0.1.0.gem',
}
Java Install
Most sites will manage Java seperately; however, this module can attempt to install Java as well.
class { 'logstash':
java_install => true,
}
Specifying a particular Java package (version) to be installed:
class { 'logstash':
java_install => true,
java_package => 'packagename'
}
Repository management
Many sites will manage repositories seperately; however, this module can manage the repository for you.
class { 'logstash':
manage_repo => true,
repo_version => '1.4',
}
Note: When using this on Debian/Ubuntu you will need to add the Puppetlabs/apt module to your modules.
If no repo_version is provided, default is set by logstash::params::repo_version
.
Init Defaults
The defaults file (/etc/default/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 on the https://discuss.elastic.co/c/logstash discussion forum.
0.6.4 Puppet 4 support.
0.6.3 Documentation updates only. Functionally identical to 0.6.2.
0.6.2 Allow electrical/file_concat version 1.x.
0.6.1 Restart service on pattern file change. Remove dependency on external PGP server. Fix circular dependency on plugin installation.
0.6.0 Deprecates the logstash-contrib package. Supports Gem-based Logstash plugins. Not compatible with Logstash versions < 1.5.0.
0.5.1 Updated system tests to work with LS 1.4.1 Increase package download timeout Add option to use stages for the repo setup instead anchors
0.5.0 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 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 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 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 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 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 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 Fixing issue when using jar file without multi-instance feature Added rspec tests to cover this issue
0.3.1 Missed changes for enabling/disabling multi-instance feature Adding a few spec tests for the multi-instance feature
0.3.0 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 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 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 Fix issue that the init file was overwritten Ensure we install java first before starting logstash if enabled
0.0.5 Adding spec tests Update Readme ( PR #20 by rjw1 ) New feature to install java
0.0.4 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 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 Adding a way to provide jar and init file instead of depending on a package
0.0.1 Initial release of the module
Dependencies
- puppetlabs/stdlib (>= 3.2.0 <5.0.0)
- electrical/file_concat (>= 0.1.0 <2.0.0)
Copyright (c) 2012-2016 Elasticsearch <http://www.elastic.co> 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.