No commit activity in last 3 years
No release in over 3 years
Send report to logstash port listening for json_events
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

> 10.14
 Project Readme

Description

This is a Chef report handler that exports a report in json format to the configured server/port. We are using it to report to logstash but probably you can hook it into anything that accepts a json :)

Requirements

Only works on Chef >= 10.14

Usage

There are two ways to use Chef Handlers.

Method 1 (recommended)

Use the chef_handler cookbook by Opscode. Create a recipe with the following:

include_recipe "chef_handler"

# Install `chef-handler-logstash` gem during the compile phase
chef_gem "chef-handler-logstash"

# load the gem here so it gets added to the $LOAD_PATH, otherwise chef_handler
# will fail.
require 'chef/handler/chef_logstash'

# Activate the handler immediately during compile phase
chef_handler "Chef::Handler::Logstash" do
  source "chef/handler/chef_logstash"
  arguments [
     :host => 'your_logstash_host',
     :port => 'your_logstash_port',
     :tags => 'array_of_tags',
     :timeout => 'timeout when trying to reach the logstash server. Integer'
  ]
  action :nothing
end.run_action(:enable)

Method 2

Install the gem ahead of time, and configure Chef to use them:

gem install chef-handler-logstash

Then add to the configuration (/etc/chef/solo.rb for chef-solo or /etc/chef/client.rb for chef-client):

require "chef/handler/chef_logstash"
report_handlers << Chef::Handler::Logstash.new(:host => 'foo', :port => 'bar', :timeout => 15, :tags => ['chef-client'])
exception_handlers << Chef::Handler::Logstash.new(:host => 'foo', :port => 'bar', :timeout => 15, :tags => ['chef-client'])

License and Author

Licensed under the MIT license. See MIT-LICENSE file for details.

Author:: Nadir Lloret https://github.com/nadirollo