> On 27.05.2016, at 19:41, Christopher Schultz <ch...@christopherschultz.net> > wrote: > > AccessLogValve was written to conform to the age-old httpd log file > format, subject to whatever "pattern" you want to apply. > > You could sprinkle your pattern full of JSON stuff, but then > JSON-escaping wouldn't actually occur, etc. > > If you want JSON logging, you are going to have to write your own valve.
logback has an additional module called logback-access[1], that implements an access log valve for Tomcat. You could then use a logbook appender that writes JSON, eg. the logstash-logback-encoder[2]. Disclaimer: I’ve never used that combination, and don’t know if there are incombatibilities. In theory, it should work. Rainer [1] http://logback.qos.ch/access.html [2] https://github.com/logstash/logstash-logback-encoder