Current section
Files
Jump to
Current section
Files
gelf_logger
README.md
README.md
# GelfLogger [](https://travis-ci.org/jschniper/gelf_logger)A logger backend that will generate Graylog Extended Log Format messages. Thecurrent version only supports UDP messages.## ConfigurationIn the config.exs, add gelf_logger as a backend like this:```config :logger, backends: [:console, {Logger.Backends.Gelf, :gelf_logger}]```In addition, you'll need to pass in some configuration items to the backenditself:```config :logger, :gelf_logger, host: "127.0.0.1", port: 12201, application: "myapp", compression: :gzip, # Defaults to :gzip, also accepts :zlib or :raw metadata: [:request_id, :function, :module, :file, :line], hostname: "hostname-override", tags: [ list: "of", extra: "tags" ]```In addition to the backend configuration, you might want to check the [Logger configuration](https://hexdocs.pm/logger/Logger.html) for other options that might be important for your particular environment. In particular, modifying the `:utc_log` setting might be necessary depending on your server configuration.This backend supports `metadata: :all`.## UsageJust use Logger as normal.## Improvements- [x] Tests- [ ] TCP Support- [x] Options for compression (none, zlib)- [x] Send timestamp instead of relying on the Graylog server to set it- [x] Find a better way of pulling the hostnameAnd probably many more. This is only out here because it might be useful tosomeone in its current state. Pull requests are always welcome.## NotesCredit where credit is due, this would not exist without[protofy/erl_graylog_sender](https://github.com/protofy/erl_graylog_sender).