ecs-logging-java icon indicating copy to clipboard operation
ecs-logging-java copied to clipboard

Output message as json

Open kk-mats opened this issue 1 year ago • 1 comments
trafficstars

Hi, I started to use this package in conjuction with logback-logstash-encoder for message layout. Then I noticed that message is output being quoted as string even if it is actually json.

I suppose this is because EcsJsonSerializer.serializeFormattedMessage is always used for any message layout in EcsEncorder. https://github.com/elastic/ecs-logging-java/blob/main/logback-ecs-encoder/src/main/java/co/elastic/logging/logback/EcsEncoder.java#L149

Currently is there any way to output message in json or do you have any plan to support such feature?

kk-mats avatar Mar 18 '24 09:03 kk-mats

You could parse the JSON message in an Elasticsearch ingest pipeline. But generally, the ecs encoder is not designed to work with another JSON encoder.

felixbarny avatar Mar 18 '24 11:03 felixbarny