logger_logstash_backend
logger_logstash_backend copied to clipboard
How to add a metadata as top level property X instead of fields.X?
When I do
logger.info("something interesting", meta: "meta_value")
,
I see on logstash meta
property is placed inside fields
i.e. fields.meta
:
Is it possible to have that property meta
as a top level property like host
, message
and type
?
Indeed , a strong and valid point (which we came across today). Other solutions do not add the 'fields' key and standarising data across platforms is a nice to have. we have modified
https://github.com/marcelog/logger_logstash_backend/blob/master/lib/logger_logstash_backend.ex#L73
to do the following:
{:ok, json} = JSX.encode Map.merge(%{
type: type,
"@timestamp": Timex.format!(ts, "%FT%T%z", :strftime),
message: to_string(msg),
}, fields)
more than happy to make a pull request but will break backward compatibility 😄 @ahmadferdous ^^ 👍