Skip to content

Instantly share code, notes, and snippets.

@pedes
Created December 1, 2021 14:58
Show Gist options
  • Save pedes/6ac65c7c707fff52dd130ceaf912970a to your computer and use it in GitHub Desktop.
Save pedes/6ac65c7c707fff52dd130ceaf912970a to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8"?>
<!-- DO NOT FORGET TO ADD THE PACKAGES ATTRIBUTE, AND REFERENCE THE SPLUNK PACKAGE -->
<!-- DO NOT FORGET TO ADD THE PACKAGES ATTRIBUTE, AND REFERENCE THE SPLUNK PACKAGE -->
<!-- DO NOT FORGET TO ADD THE PACKAGES ATTRIBUTE, AND REFERENCE THE SPLUNK PACKAGE -->
<Configuration packages="com.mulesoft.ch.logging.appender,com.splunk.logging,org.apache.logging.log4j">
<!--These are some of the loggers you can enable.
There are several more you can find in the documentation.
Besides this log4j configuration, you can also use Java VM environment variables
to enable other logs like network (-Djavax.net.debug=ssl or all) and
Garbage Collector (-XX:+PrintGC). These will be append to the console, so you will
see them in the mule_ee.log file. -->
<Appenders>
<RollingFile name="file" fileName="${sys:mule.home}${sys:file.separator}logs${sys:file.separator}splunk-forwarder.log"
filePattern="${sys:mule.home}${sys:file.separator}logs${sys:file.separator}splunk-forwarder-%i.log">
<PatternLayout pattern="%-5p %d [%t] [processor: %X{processorPath}; event: %X{correlationId}] %c: %m%n" />
<SizeBasedTriggeringPolicy size="10 MB" />
<DefaultRolloverStrategy max="10"/>
</RollingFile>
<!-- THIS CONFIGURATION FORWARDS LOGS TO SPLUNK -->
<SplunkHttp name="Splunk"
url="https://prd-p-fba02.splunkcloud.com:8088/"
token="c1d1f0c6-003b-4896-b409-eae5c6e58091"
batch_size_count="1"
index="main"
disableCertificateValidation="true">
<PatternLayout pattern="[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n" />
</SplunkHttp>
<Log4J2CloudhubLogAppender name="CLOUDHUB"
addressProvider="com.mulesoft.ch.logging.DefaultAggregatorAddressProvider"
applicationContext="com.mulesoft.ch.logging.DefaultApplicationContext"
appendRetryIntervalMs="${sys:logging.appendRetryInterval}"
appendMaxAttempts="${sys:logging.appendMaxAttempts}"
batchSendIntervalMs="${sys:logging.batchSendInterval}"
batchMaxRecords="${sys:logging.batchMaxRecords}"
memBufferMaxSize="${sys:logging.memBufferMaxSize}"
journalMaxWriteBatchSize="${sys:logging.journalMaxBatchSize}"
journalMaxFileSize="${sys:logging.journalMaxFileSize}"
clientMaxPacketSize="${sys:logging.clientMaxPacketSize}"
clientConnectTimeoutMs="${sys:logging.clientConnectTimeout}"
clientSocketTimeoutMs="${sys:logging.clientSocketTimeout}"
serverAddressPollIntervalMs="${sys:logging.serverAddressPollInterval}"
serverHeartbeatSendIntervalMs="${sys:logging.serverHeartbeatSendIntervalMs}"
statisticsPrintIntervalMs="${sys:logging.statisticsPrintIntervalMs}">
<PatternLayout pattern="[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n"/>
</Log4J2CloudhubLogAppender>
</Appenders>
<Loggers>
<!-- Http Logger shows wire traffic on DEBUG. -->
<!--AsyncLogger name="org.mule.service.http.impl.service.HttpMessageLogger" level="DEBUG" /-->
<AsyncLogger name="org.mule.service.http" level="INFO"/>
<AsyncLogger name="org.mule.extension.http" level="INFO"/>
<!-- Mule logger -->
<AsyncLogger name="org.mule.runtime.core.internal.processor.LoggerMessageProcessor" level="INFO"/>
<AsyncLogger name="com.training.monitoring" level="INFO"/>
<AsyncRoot level="INFO">
<AppenderRef ref="Splunk" />
<AppenderRef ref="CLOUDHUB" />
</AsyncRoot>
</Loggers>
</Configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment