In operations/software/gerrit we have a single cherry-pick on top of upstream stable-3.2 branch:
185bdc3a69370c3ab96cc94d20c0746fe6bade56
That is to restore the jsonevent-layout library from Maven. It is used to generate json error logs which are then relayed to logstash:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> ... <appender name="gerrit.json" class="org.apache.log4j.DailyRollingFileAppender"> <param name="encoding" value="UTF-8"/> <param name="File" value="/var/log/gerrit/gerrit.json"/> <!--<param name="fileAppend" value="true"/>--> <param name="immediateFlush" value="true"/> <param name="threshold" value="INFO"/> <layout class="net.logstash.log4j.JSONEventLayoutV1"/> </appender>
Eventually I have found out the Gerrit daemon is able to generate the file all by itself by enabling log.jsonLogging (default: false). https://gerrit.wikimedia.org/r/Documentation/config-gerrit.html#log.jsonLogging . That has been possible since Gerrit 2.12.
Theorically we can thus turn on jsonLogging in Gerrit, remove the log4j appender and we would no more depend on jsonevent-layout.
A couple things to check:
- whether our logstash receiver will properly recognizes it
- log.jsonLogging also acts on the httpd and sshd logs.