internetitem / logback-elasticsearch-appender

Logback Elasticsearch Appender
Other
233 stars 137 forks source link

Context map feature #65

Open ntvf opened 4 years ago

ntvf commented 4 years ago

Inspired by Context Map feature from logstash-logback-encoder for adding event-specific custom fields to message. Example: Log line: log.info("Service started in {} seconds", duration/1000, Collections.singletonMap("duration", duration));

Result: { "@timestamp": "2014-06-04T15:26:14.464+02:00", "message": "Service started in 12 seconds", "duration": 12368, }

knittl commented 4 years ago

Interesting take on this one. Does it support multiple "structured arguments" too or only a single map? I don't understand how the formatting of the map for the message itself works – wouldn't that be {duration=12} in the message?

knittl commented 4 years ago

Nevermind, I saw only now that duration is passed once directly as argument and then as context map parameter.