LogstashLoggerFormatter (logstash_logger_formatter v1.0.0)
This is a replacement for Logger console backend default formatter.
It allows formatting log records in Logstash-friendly format and continue using Logger console backend, which is robust and doesn't bring the system down if for some reason I/O subsystem becomes too slow or even got stuck.
See Logger documentation.
The formatter is configured via :logstash_formatter
key in config.exs
:
config :logger, :logstash_formatter,
engine: Jason,
timestamp_field: "@timestamp",
message_field: "message",
extra_fields: %{"application" => "foo"}
config :logger, :console,
format: {LogstashLoggerFormatter, :format}
Link to this section Summary
Link to this section Functions
Link to this function
format(level, message, timestamp, metadata)
Specs
format(Logger.level(), Logger.message(), Logger.Formatter.time(), Keyword.t()) :: IO.chardata()