diff --git a/README.md b/README.md index d237e75..66660ec 100644 --- a/README.md +++ b/README.md @@ -4,26 +4,28 @@ Sidekiq::Logstash turns your [Sidekiq](https://github.com/mperham/sidekiq) log into an organised, aggregated, JSON-syntax log ready to be sent to a logstash server. - { - "class" : "MyWorker", - "args" : ["first_param","second_param"], - "retry" : true, - "queue" : "default", - "jid" : "fd71783c0afa3f5e0958f3e9", - "created_at" : "2016-07-02T14:03:26.423Z", - "enqueued_at" : "2016-07-02T14:03:26.425Z", - "started_at" : "2016-07-02T14:03:26.953Z", - "retried_at" : "2016-07-02T16:28:42.195Z", - "failed_at" : "2016-07-02T13:04:58.298Z", - "retried_at" : "2016-07-02T14:04:11.051Z", - "retry_count" : 1, - "pid" : 70354, - "duration" : 0.306, - "error_message" : "An error message that occurred during job execution.", - "error_backtrace" : "...", - "@timestamp" : "2016-07-02T14:03:27.259Z", - "@version" : "1" - } +```json +{ + "class" : "MyWorker", + "args" : ["first_param","second_param"], + "retry" : true, + "queue" : "default", + "jid" : "fd71783c0afa3f5e0958f3e9", + "created_at" : "2016-07-02T14:03:26.423Z", + "enqueued_at" : "2016-07-02T14:03:26.425Z", + "started_at" : "2016-07-02T14:03:26.953Z", + "retried_at" : "2016-07-02T16:28:42.195Z", + "failed_at" : "2016-07-02T13:04:58.298Z", + "retried_at" : "2016-07-02T14:04:11.051Z", + "retry_count" : 1, + "pid" : 70354, + "duration" : 0.306, + "error_message" : "An error message that occurred during job execution.", + "error_backtrace" : "...", + "@timestamp" : "2016-07-02T14:03:27.259Z", + "@version" : "1" +} +``` ## Installation @@ -35,18 +37,22 @@ gem 'sidekiq-logstash' And then execute: - $ bundle +```bash +$ bundle +``` Or install it yourself as: - $ gem install sidekiq-logstash +```bash +$ gem install sidekiq-logstash +``` ## Usage Simply add the following to your sidekiq configuration (in Rails, this will be `initializers/sidekiq.rb`) - - Sidekiq::Logstash.setup - +```ruby +Sidekiq::Logstash.setup +``` I suggest you add it on top of it, before any other `Sidekiq.configure_server` initialization, in order to avoid unformatted logging. ## Development