Notice
This cookbook is under active development, and its public interface may change.
What this warning means is that the attributes, and actions used by logstash_instance
and logstash_config may drastically change. When using this cookbook please reference
an exact SHA commit from this repository to ensure continuous functionality.
chef_logstash cookbook
This is a Library Style cookbook that provides Chef Resource Providers to create and manage your Logstash environment.
Requirements
The following cookbooks are suggested to use this cookbook:
Usage
Resources and Providers
logstash_instance
The intention is to provide a stable interface to creating instances of
Logstash on your servers. This means creating a instance via
logstash_instance will download, install, and setup a functional
instance of Logstash but it does not handle any configuration details.
The following actions are supported and :create is the default:
-
:create- Creates a named instance of Logstash. This action will download logstash:versionto the:dst_dir. It creates the:userand:groupused to run Logstash. And finally it creates therunitresource required to manage the service. It does not start the service as that is a job for:enable. -
:enable- Enables the specifiedservice_typeor the defaultinit. -
:update- -
:destroy- -
:nothing-
These attributes are defined in the resource:
nameusergroupconf_dirdst_dirservice_type-service_options-install_type-install_options-
Usage example:
logstash_instance 'default' do
install_options({
url: node.logstash.install_options.fetch(:url),
checksum: node.logstash.install_options.fetch(:checksum),
version: node.logstash.install_options.fetch(:version)
})
action [:create, :enable]
end
logstash_config
The following actions are supported and :create is the default:
:create- Creates a named configuration for a specific Logstash plugin. This action will create a sub-resource based on theplugin_typeandpluginspecified. Theplugin_configattribute will be passed to the sub-resource during resource creation. We use theinstanceattribute to link this configuration to a specific Logstash instance.:enable- Ensures the configuration for the specified instance has been loaded.:update-:destroy- Remove the named configuration.:nothing- Does nothing, except define the resource with the associated attributes.
These attributes are defined in the resource:
instance- The Logstash instance this plugin is associated with.plugin- One of the numerous Logstash plugins.plugin_type- Accepts one of 'input', 'filter', 'output'plugin_config- A hash containing the key-value pairs that configure the plugin.
Usage example:
logstash_config 'httpd_log_files' do
instance 'default'
plugin 'file'
plugin_type 'input'
plugin_config({
path: ['/var/log/httpd/*_log'],
type: 'httpd'
})
action [:create, :enable]
end
Contributing
- Fork it.
- Create a branch (
git checkout -b my_changes) - Commit your changes (
git commit -am "Added Snark") - Push to the branch (
git push origin my_changes) - Open a Pull Request
- Enjoy a refreshing Slurm and wait
Testing
Code Style
This code follows the Ruby Style Guide and all contributions should as well.
The code style is checked by Rubocop and can be checked by executing rake test:rubocop or rubocop.
Author
Author:: Miah Johnson (miah@chia-pet.org)
Donations
License
Copyright 2013 Miah Johnson
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.




