Skip to content

Commit

Permalink
Improved Readme code blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
iMacTia authored Jul 4, 2016
1 parent a11a74a commit 8b7f28e
Showing 1 changed file with 31 additions and 25 deletions.
56 changes: 31 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit 8b7f28e

Please sign in to comment.