Posting logs of underlying plugin libraries to Logstash log stream

Is it possible to post logs of underlying libraries to Logstash log stream?

For instance, I use input JDBC plugin with MSSQL JDBC driver and I would like to see logs of the driver library for debug purposes.

Is it possible? I haven't found any related articles on the net.

I want to note that MSSQL JDBC driver librart relies on java.util.logging (JUL) while Logstash utilizes Log4j2 for internal logging purposes.

So, in any case I will need to set up a logging bridge.

I've managed to solve the issue on my own with the steps below.
I'm using 8.5.1 version of Logstash as Docker image.

  1. Add Apache Log4j JUL Adapter JAR to /opt/logstash/logstash-core/lib/jars/.
  2. Set the system property java.util.logging.manager to org.apache.logging.log4j.jul.LogManager. I did it with the following command in Dockerfile: ENV LS_JAVA_OPTS -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager
  3. Add required logging configuration to /opt/logstash/config/log4j2.properties file. In my case I just added the 2 lines to enable FINER logging for com.microsoft.sqlserver.jdbc.internals.SQLServerConnection class:
logger.sqlserverconnection.name = com.microsoft.sqlserver.jdbc.internals.SQLServerConnection
logger.sqlserverconnection.level = trace

Steps 1 and 2 were taken from the Apache guide.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.