https://github.com/kociamber/logger_gelf
Greylog backend for Elixir Logger.
https://github.com/kociamber/logger_gelf
elixir greylog logger
Last synced: 3 months ago
JSON representation
Greylog backend for Elixir Logger.
- Host: GitHub
- URL: https://github.com/kociamber/logger_gelf
- Owner: Kociamber
- Created: 2019-04-20T09:18:30.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-04-29T12:56:15.000Z (about 6 years ago)
- Last Synced: 2025-01-19T11:42:18.745Z (5 months ago)
- Topics: elixir, greylog, logger
- Language: Elixir
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LoggerGelf [](https://travis-ci.org/kociamber/logger_gelf)
**!!Currently WIP!!**This application is able to generate Graylog Extended Log Format (GELF) UDP messages (TCP version coming soon)
## Installation
The package can be installed
by adding `logger_gelf` to your list of dependencies in `mix.exs`:```elixir
def deps do
[
{:logger_gelf, "~> 0.1.0"}
]
end
```
## ConfigurationIn the config.exs, add gelf_logger as a backend / add it to backends list:
```elixir
config :logger,
backends: [:console, {LoggerGelf, :logger_gelf}]
```You will also have to handle mandatory configuration:
```elixir
config :logger, :logger_gelf,
application: "my_application",
greylog_hostname: "127.0.0.1",
greylog_hostport: 12201,
```
optional config:```elixir
hostname: "hostname", #defaults to :inet.gethostname/0 result
level: :warn, # defaults to lowest level (:debug)
metadata: [:id, :module, :record], # defaults to :all
metadata_formatter: {Module, :function, arity}, # custom metadata formatter - you can add any function from your module and use it for metadata formatting, skipping the option will leave metadata as it is
json_encoder: Jason, #defaults to Jason, can be overriden by any module using encode!/1 (ie. Poison)
compression: :gzip, # defaults to :gzip, :zlib or :raw are also available
```## Usage
Just add to deps, configure and use Logger as usual.
## Credits
Credit where credit is due! This implementation was heavily inspired by:
[jschniper/gelf_logger](https://github.com/jschniper/gelf_logger).