No commit activity in last 3 years
No release in over 3 years
Awesome rails logs supports delayed jobs
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.0.0
>= 3.0
>= 2.14

Runtime

>= 4.0.2
>= 0.8.1
 Project Readme

LogstasherPluginDelayed Gem Version Build Status

This is the first plugin for the plugin infrastructure supported by logstasher to add logstasher and request based logging to logstash.

Before 'logstasher-plugin-delayed'

{"sql":"SELECT `delayed_jobs`.* FROM `delayed_jobs` WHERE ((run_at <= '2015-10-25 17:45:58' AND (locked_at IS NULL OR locked_at < '2015-10-25 13:45:58') OR locked_by = 'delayed_job host:marclaptop pid:9681') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC, id ASC LIMIT 5 /*application:Banking*/","name":"Delayed::Backend::ActiveRecord::Job Load","connection_id":25418200,"binds":[],"duration":0.42,"tags":["request"],"@timestamp":"2015-10-25T17:45:58Z","@version":"1"}
{"sql":"SELECT `users`.* FROM `users` ORDER BY `users`.`id` DESC LIMIT 1 /*application:Banking*/","name":"User Load","connection_id":33378460,"binds":[],"duration":0.42,"tags":["request"],"@timestamp":"2015-10-25T17:46:00Z","@version":"1"}
{"sql":"SELECT `delayed_jobs`.* FROM `delayed_jobs` WHERE ((run_at <= '2015-10-25 17:46:00' AND (locked_at IS NULL OR locked_at < '2015-10-25 13:46:00') OR locked_by = 'delayed_job host:marclaptop pid:9681') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC, id ASC LIMIT 5 /*application:Banking*/","name":"Delayed::Backend::ActiveRecord::Job Load","connection_id":25418200,"binds":[],"duration":0.3,"tags":["request"],"@timestamp":"2015-10-25T17:46:00Z","@version":"1"}

After 'logstasher-plugin-delayed'

{"sql":"SELECT `delayed_jobs`.* FROM `delayed_jobs` WHERE ((run_at <= '2015-10-25 17:45:58' AND (locked_at IS NULL OR locked_at < '2015-10-25 13:45:58') OR locked_by = 'delayed_job host:marclaptop pid:9681') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC, id ASC LIMIT 5 /*application:Banking*/","name":"Delayed::Backend::ActiveRecord::Job Load","connection_id":25418200,"binds":[],"duration":0.42,"operator":"marc","request_id":10,"source":"FOS Banking Delayed Job","tags":["request"],"@timestamp":"2015-10-25T17:45:58Z","@version":"1"}
{"sql":"SELECT `users`.* FROM `users` ORDER BY `users`.`id` DESC LIMIT 1 /*application:Banking*/","name":"User Load","connection_id":33378460,"binds":[],"duration":0.42,"operator":"marc","request_id":"3719","source":"FOS Banking Console","tags":["request"],"@timestamp":"2015-10-25T17:46:00Z","@version":"1"}
{"sql":"SELECT `delayed_jobs`.* FROM `delayed_jobs` WHERE ((run_at <= '2015-10-25 17:46:00' AND (locked_at IS NULL OR locked_at < '2015-10-25 13:46:00') OR locked_by = 'delayed_job host:marclaptop pid:9681') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC, id ASC LIMIT 5 /*application:Banking*/","name":"Delayed::Backend::ActiveRecord::Job Load","connection_id":25418200,"binds":[],"duration":0.3,"operator":"marc","request_id":10,"source":"FOS Banking Delayed Job","tags":["request"],"@timestamp":"2015-10-25T17:46:00Z","@version":"1"}

You see now we see a request_id which basically is the id of delayed job. All susequent to this DJ belonging logs will have this request id.

Installation

In your Gemfile:

gem 'logstasher'
gem 'logstasher-plugin-delayed'

Configure your .rb e.g. development.rb

# Enable delayed job logstaher logs for the current environment
config.logstasher_plugin_delayed = true

Versions

All versions require Rails 3.0.x and higher and Ruby 2.1+. Tested on Rails 3.2 and Ruby 2.1

Development

  • Run tests - rake
  • Generate test coverage report - rake coverage. Coverage report path - coverage/index.html

Copyright

Copyright (c) 2015 Marc Grimme, released under the MIT license

Bitdeli Badge