Project

fluentdly

0.0
No commit activity in last 3 years
No release in over 3 years
Allows to customize messages for sending logs to fluentd
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.11
>= 0
>= 0
~> 10.0
~> 3.0

Runtime

 Project Readme

Fluentdly

Fluentdly is a wrapper for easily structured logging HTTP and non HTTP requests using fluent-logger.

Installation

Add this line to your application's Gemfile:

gem 'fluentdly'

And then execute:

$ bundle

Or install it yourself as:

$ gem install fluentdly

Examples

###Configure logger

Setup fluent-logger parameters. See link

$logger = Fluentdly::Logger.new({:host => 'myhost', :port => 24224, :app_name => 'my_app'})

Configure fluentdly task logger:

Fluentdly.configure do |config|
  config.task_logger = $logger
end

###Configure middleware HTTP params to log

Custom parameters will merge with default ones: :method, :query_string and :path

require 'fluentdly'

  Fluentdly.configure do |config|
    custom_parameters = {
      :user_agent => 'HTTP_USER_AGENT',
      :uri        => 'REQUEST_URI'
    }

    config.request_parameters custom_parameters
  end

###Task logging example

Fluentdly::Task.log(:info, {:log_param => 'log_information' ... }) do
  your_business_logic_here

  [status, result]
end

###Setup middleware

For instance in config.ru for rack applications:

use Fluentdly::Rack::Middleware

License

The gem is available as open source under the terms of the MIT License.