How to Set Up Logging for the Syslog
The purpose of this article is to describe how to enhance the configuration of the logging framework used by IBM Manta Data Lineage (Log4j) to log in to the Syslog.
Instructions
Each Manta Data Lineage component has its own logging configuration. If it is desirable for all of them to log in to Syslog, all the following configurations have to be adjusted.
-
<MANTA_HOME>/server/webapps/manta-dataflow-server/WEB-INF/classes/log4j2.xml
-
<MANTA_HOME>/cli/scenarios/manta-dataflow-cli/etc/log4j2.xml
-
<MANTA_HOME>/serviceutility/webapps/manta-admin-gui/WEB-INF/classes/log4j2.xml
In order to adjust a configuration:
-
Open the configuration file.
-
Add a new appender to the
Appenders
tag. The appender should be defined by pair tags (opening and closing) as shown in the following steps. Nested tags will be provided. Below are some examples of appenders forBSD
andRFC5424
standards. For more detailed documentation on appenders, please refer to https://logging.apache.org/log4j/2.x/manual/appenders.html#SyslogAppender.-
Example of a
BDS
appender:<Syslog name="syslogAppender" host="localhost" port="1670" protocol="TCP"> <!-- The nested tags will be defined in step #4 of the tutorial --> </Syslog>
-
Example of a
RFC5424
appender:<Syslog name="syslogAppender" format="RFC5424" host="localhost" port="1670" protocol="TCP" appName="MANTA" includeMDC="true" facility="LOCAL0" enterpriseNumber="18060" newLine="true" messageId="Audit" id="App"> <!-- The nested tags will be defined in step #4 of the tutorial --> </Syslog>
-
-
Set the values of the
host
andport
attributes (and other advanced attributes, if used) based on your environment. -
Copy the
PatternLayout
tag from one of the predefined appenders and put it inside your newsyslogAppender
tag (between the opening and closing tags). Here is an example of aPatternLayout
definition. (This example is from a specific version of Manta Data Lineage. The definition may be different in newer versions of Manta Data Lineage.)<PatternLayout> <MarkerPatternSelector defaultPattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} %equals{%X{context-set}}{true}{[Context: %X{CONTEXT}] }%msg%n"> <PatternMatch key="ERROR" pattern="%n%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} %equals{%X{context-set}}{true}{[Context: %X{CONTEXT}]}%n%X{CATEGORY} %X{ERROR_TYPE}%nUser message: %X{USER_MESSAGE}%nTechnical message: %X{TECHNICAL_MESSAGE}%nSolution: %X{SOLUTION}%nImpact: %X{IMPACT}%n%n"/> <PatternMatch key="PROGRESS" pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] Current progress for connection %X{CONNECTION_ID}: %X{PROGRESS_PERCENTAGE}%enc{%}. Finished %X{CURRENT_PROGRESS} objects out of %X{TOTAL_PROGRESS}.%n"/> </MarkerPatternSelector> </PatternLayout>
-
Add the
syslogAppender
reference to all thelogger
tags that are defined in theLoggers
tag.
After the configuration is finalized, Manta Flow Server and Manta Admin UI have to be restarted for the changes to take effect.