How to externalize Denodo log files

You can translate the document:

Introduction

By default, all the Denodo logs are stored as log files under the <DENODO_HOME>/logs folder. Similar to storing the Denodo Monitor logs in an external database, we can store all the logs of the Denodo Platform in an external database with the help of log4j. The log4j API used by Denodo provides a JDBC Appender option, which can store logging information in a specific database.

This document shows an example on how to store Denodo logs in a MS SQL Server database.

Storing the Virtual DataPort (VDP) logs in an external database

NOTE: Create a backup of the configuration file before making any changes.

Step 1: Create a table in an external database

The following example shows the syntax to create the table needed for MS SQL Server.

CREATE TABLE vdp_logs(

        LOG_ID varchar(100) primary key,

        ENTRY_DATE datetime,

        LOGGER varchar(100),

        LOG_LEVEL varchar(100),

        MESSAGE TEXT,

        EXCEPTION TEXT

);

Step 2: Add the JDBC driver for the external database

  • Stop the Denodo VDP server.
  • Place the jar files for the driver under <DENODO_HOME>\extensions\thirdparty\lib
  • For the databases supported by Denodo as data sources you might be able to find the driver files already included as part of the installation.

For instance, for MS SQL Server, you can copy the jar files located under         <DENODO_HOME>\lib\extensions\jdbc-drivers\mssql-jdbc-7.x (use the driver version that matches the destination database).

Step 3: Edit the log4j2.xml file

Add the following in the Appenders section of the <DENODO_HOME>/conf/vdp/log4j2.xml file. Replace the schema name, table name and connection details with the actual values.

<JDBC name="SQLServerDatabase" tableName="<schema_name>.<Table_name>">

        <DriverManager connectionString="jdbc:sqlserver://<Host_name>:<port_number>;databaseName=<DB_NAME>" username="<user_name>" password="<Password>"/>

        <Column name="LOG_ID" pattern="%u" isUnicode="false"/>

        <Column name="ENTRY_DATE" isEventTimestamp="true" />

        <Column name="LOGGER" pattern="%logger" isUnicode="false"/>

        <Column name="LOG_LEVEL" pattern="%level" isUnicode="false"/>

        <Column name="MESSAGE" pattern="%m" isUnicode="false"/>  

        <Column name="EXCEPTION" pattern="%throwable" isUnicode="false"/>    

    </JDBC>

In addition to that, enable the JDBC appender by adding the below line at the end of the root level.

<Root level="error">

      <AppenderRef ref="FILEOUT" />

         <AppenderRef ref="SQLServerDatabase" />

Step 4: Visualizing logs in MS-SQL

  • Start the VDP server.
  • After the restart, the VDP logs will be stored in the selected database and table that can then be queried as any database table.

Storing other Denodo Platform logs

To store the logs of the other Denodo Platform components in an external database, follow similar steps for each component. Create separate tables for each log in the external database, update the corresponding log4j2.xml files and place the driver files in the respective location and restart the server.

Scheduler

  • Edit the log4j2.xml file located under  <DENODO_HOME>\conf\scheduler
  • Place the driver files under <DENODO_HOME>\lib\scheduler-extensions

Web Design Studio

  • Edit the log4j2.xml file located under <DENODO_HOME>\conf\design-studio
  • Place the driver files under <DENODO_HOME>\resources\apache-tomcat\lib

Data Catalog

  • Edit the log4j2.xml file located under <DENODO_HOME>\conf\data-catalog
  • Place the driver files under <DENODO_HOME>\resources\apache-tomcat\lib

Diagnostic and Monitoring Tool

  • Edit the log4j2.xml file located under <DENODO_HOME>\conf\diagnostic-monitoring-tool
  • Place the driver files under <DENODO_HOME>\resources\apache-tomcat\lib

Storing the Solution Manager logs in an External Database

  • In order to store the Solution Manager logs, create the following table in an external database (example for MS SQL Server)

CREATE TABLE SM_logs(

[LOG_ID] [varchar](100) ,

[ENTRY_DATE] [datetime] ,

[LOGGER] [varchar](100) ,

[LOG_LEVEL] [varchar](100) ,

[MESSAGE] [text] ,

[EXCEPTION] [text])

  • Edit the log4j2.xml file located under the folder <Solution-Manager>\conf\solution-manager and add the following SQLServerDatabase appender in the Appenders section. Replace the schema name, table name and connection details with the actual values:

    <JDBC name="SQLServerDatabase" tableName="<Schema>.<table_name>">

        <DriverManager connectionString="jdbc:sqlserver://<hostname>:<port_number>;databaseName=<database>" username="<username>" password="<Password>"/>

        <Column name="LOG_ID" pattern="%u" isUnicode="false"/>

        <Column name="ENTRY_DATE" isEventTimestamp="true" />

        <Column name="LOGGER" pattern="%logger" isUnicode="false"/>

        <Column name="LOG_LEVEL" pattern="%level" isUnicode="false"/>

        <Column name="MESSAGE" pattern="%m" isUnicode="false"/>  

        <Column name="EXCEPTION" pattern="%throwable" isUnicode="false"/>  

    </JDBC>

  • In addition to that, enable the JDBC appender by adding the below line at the end of the root level.

    <Root level="error" >

      <AppenderRef ref="FILEOUT" />

         <AppenderRef ref="SQLServerDatabase" />

  • Place the driver files under <SOLMAN_HOME>\lib\solution-manager-extensions.
  • Restart the Solution Manager server to see the logs in the external database.

To store the logs of the other Solution Manager installation componentes you can follow similar steps.

License Manager

  • Edit the log4j2.xml file under <SOLMAN_HOME>\conf\license-manager
  • Place the driver files under <Solution-Manager>\lib\solution-manager-extensions

Solution Manager Web Tool

  •  Edit the log4j2.xml file under <SOLMAN_HOME>\conf\solution-manager-web-tool
  • Place the driver files under <SOLMAN_HOME>\resources\apache-tomcat\lib

References

Log4j 2 Layouts

Intro to Log4j2 - Appenders, Layouts and Filters | Baeldung

Disclaimer

The information provided in the Denodo Knowledge Base is intended to assist our users in advanced uses of Denodo. Please note that the results from the application of processes and configurations detailed in these documents may vary depending on your specific environment. Use them at your own discretion.

For an official guide of supported features, please refer to the User Manuals. For questions on critical systems or complex environments we recommend you to contact your Denodo Customer Success Manager.
Recommendation

Recommended resources Recommendations generated by AI

Using logcontroller and useful log categories

How to configure the Denodo Monitor to delete old log files

How to enable logging in the Denodo Monitor

Log column details

How to store Denodo logs in Azure Blob Storage

Questions

Ask a question

You must sign in to ask a question. If you do not have an account, you can register here