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.
This is a Library Style cookbook that provides Chef Resource Providers to create and manage your Logstash environment.
The following cookbooks are suggested to use this cookbook:
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:version
to the:dst_dir
. It creates the:user
and:group
used to run Logstash. And finally it creates therunit
resource required to manage the service. It does not start the service as that is a job for:enable
. -
:enable
- Enables the specifiedservice_type
or the defaultinit
. -
:update
- -
:destroy
- -
:nothing
-
These attributes are defined in the resource:
name
user
group
conf_dir
dst_dir
service_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
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_type
andplugin
specified. Theplugin_config
attribute will be passed to the sub-resource during resource creation. We use theinstance
attribute 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
- 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
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:: Miah Johnson ([email protected])
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.