Skip to content

Commit

Permalink
Updated readme [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
dwbutler committed Aug 26, 2015
1 parent 53f6b1b commit 3dc8f18
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Or install it yourself as:

$ gem install logstash-logger

## Basic Usage
## Usage Examples

```ruby
require 'logstash-logger'
Expand All @@ -49,6 +49,12 @@ stdout_logger = LogStashLogger.new(type: :stdout)
stderr_logger = LogStashLogger.new(type: :stderr)
io_logger = LogStashLogger.new(type: :io, io: io)

# Use a different formatter
cee_logger = LogStashLogger.new(type: :tcp, host: 'logsene-receiver-syslog.sematext.com', port: 514, formatter: :cee_syslog)
custom_formatted_logger = LogStashLogger.new(type: :redis, formatter: MyCustomFormatter)
lambda_formatted_logger = LogStashLogger.new(type: :stdout, formatter: ->(severity, time, progname, msg) { "[#{progname}] #{msg}" })
ruby_default_formatter_logger = LogStashLogger.new(type: :file, path: 'log/development.log', formatter: ::Logger::Formatter)

# Multiple Outputs
multi_logger = LogStashLogger.new([{type: :file, path: 'log/development.log'}, {type: :udp, host: 'localhost', port: 5228}])

Expand Down Expand Up @@ -77,7 +83,7 @@ logger.tagged('foo') { logger.fatal('bar') }
## URI Configuration
You can use a URI to configure your logstash logger instead of a hash. This is useful in environments
such as Heroku where you may want to read configuration values from the environment. The URI scheme
is `type://host:port/path`. Some sample URI configurations are given below.
is `type://host:port/path?key=value`. Some sample URI configurations are given below.

```
udp://localhost:5228
Expand All @@ -97,7 +103,7 @@ Pass the URI into your logstash logger like so:
logger = LogStashLogger.new(uri: ENV['LOGSTASH_URI'])
```

## Logstash Configuration
## Logstash Listener Configuration

In order for logstash to correctly receive and parse the events, you will need to
configure and run a listener that uses the `json_lines` codec. For example, to receive
Expand Down

0 comments on commit 3dc8f18

Please sign in to comment.