Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marcelog/logger_logstash_backend
Logstash backend for the Elixir Logger
https://github.com/marcelog/logger_logstash_backend
elixir elixir-logger logger logstash udp
Last synced: 4 days ago
JSON representation
Logstash backend for the Elixir Logger
- Host: GitHub
- URL: https://github.com/marcelog/logger_logstash_backend
- Owner: marcelog
- License: apache-2.0
- Created: 2015-06-13T21:26:14.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-04-01T09:13:24.000Z (almost 6 years ago)
- Last Synced: 2024-12-31T07:12:17.606Z (11 days ago)
- Topics: elixir, elixir-logger, logger, logstash, udp
- Language: Elixir
- Size: 35.2 KB
- Stars: 73
- Watchers: 3
- Forks: 40
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - A backend for the Elixir Logger that will send logs to the Logstash UDP input. (Logging)
- fucking-awesome-elixir - logger_logstash_backend - A backend for the Elixir Logger that will send logs to the Logstash UDP input. (Logging)
- awesome-elixir - logger_logstash_backend - A backend for the Elixir Logger that will send logs to the Logstash UDP input. (Logging)
README
[![Build Status](https://travis-ci.org/marcelog/logger_logstash_backend.svg)](https://travis-ci.org/marcelog/logger_logstash_backend)
LoggerLogstashBackend
=====================## About
A backend for the [Elixir Logger](http://elixir-lang.org/docs/v1.0/logger/Logger.html)
that will send logs to the [Logstash UDP input](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-udp.html).## Supported options
* **host**: String.t. The hostname or ip address where to send the logs.
* **port**: Integer. The port number. Logstash should be listening with its UDP
inputter.
* **metadata**: Keyword.t. Extra fields to be added when sending the logs. These will
be merged with the metadata sent in every log message.
* **level**: Atom. Minimum level for this backend.
* **type**: String.t. Type of logs. Useful to filter in logstash.## Sample Logstash config
```
input {
udp {
codec => json
port => 10001
queue_size => 10000
workers => 10
type => default_log_type
}
}
output {
stdout {}
elasticsearch {
protocol => http
}
}
```## Using it with Mix
To use it in your Mix projects, first add it as a dependency:
```elixir
def deps do
[{:logger_logstash_backend, "~> 3.0.0"}]
end
```
Then run mix deps.get to install it.Add logger and tzdata as applications:
```elixir
def application do
[applications: [:logger, :timex]]
end
```## Configuration Examples
### Runtime
```elixir
Logger.add_backend {LoggerLogstashBackend, :debug}
Logger.configure {LoggerLogstashBackend, :debug},
host: "127.0.0.1",
port: 10001,
level: :debug,
metadata: ...
```### Application config
```elixir
config :logger,
backends: [{LoggerLogstashBackend, :error_log}, :console]config :logger, :error_log,
host: "some.host.com",
port: 10001,
level: :error,
type: "my_type_of_app_or_node",
metadata: [
extra_fields: "go here"
]
```