You may want to send logs directly to a syslog, a syslog-ng or a rsyslog system.
Procedure
-
Open the
<RemoteEngineInstallationDirectory>/etc/org.ops4j.pax.logging.cfg
file and add the following lines:
Example
log4j2.appender.syslog.type = Syslog log4j2.appender.syslog.name = SyslogAppender log4j2.appender.syslog.format = RFC5424 log4j2.appender.syslog.host = localhost log4j2.appender.syslog.port = 514 log4j2.appender.syslog.protocol = TCP log4j2.appender.syslog.appName = RE log4j2.appender.syslog.includeMDC = true log4j2.appender.syslog.facility = LOCAL0 log4j2.appender.syslog.layout.type = JsonTemplateLayout log4j2.appender.syslog.layout.eventTemplateUri=${karaf.base.uri}/etc/jsonLogMinTemplate.json log4j2.appender.syslog.layout.stackTraceElementTemplateUri=${karaf.base.uri}/etc/StackTraceElementLayout.json log4j2.rootLogger.appenderRef.SyslogAppender.ref = SyslogAppender
- Save the file.
-
Add the Mapped Diagnostic Context (MDC) information to the JSON template file
so that the output logs, where applicable, contain the MDC information. This MDC
information includes the run ID of a Talend Cloud Management Console task.
- In <RemoteEngineInstallationDirectory>/etc, create a file and name it as jsonLogMinTemplateCustom.json.
-
Add the following lines to this new file to create a MDC
resolver:
Example
{ "logMessage": \{"$resolver": "message", "stringified": true}, "mdc": { "$resolver": "mdc" }, "logTimestamp": \{"$resolver": "timestamp", "epoch": {"unit": "millis", "rounded": true}}, "severity": \{"$resolver": "level", "field": "name"}, "ticLogLevel": \{"$resolver": "source", "field": "ticLogLevel"}, "bundle.name": \{"$resolver": "source", "field": "bundle.name"}, "bundle.version": \{"$resolver": "source", "field": "bundle.version"} }
- Configure your Syslog system to use this new jsonLogMinTemplateCustom.json template instead of the default template file jsonLogMinTemplate.json.