Following is the example of the pom.xml file.
<dependency> <groupId>com.kdgregory.logging</groupId> <artifactId>log4j2-aws-appenders</artifactId> <version>2.4.1</version> </dependency> <dependency> <groupId>com.amazonaws</groupId> <artifactId>aws-java-sdk-logs</artifactId> <version>1.12.293</version> </dependency>
Followings are the snippets of log4j.xml configurations for CloudHub 1.0 application.
.......
<Configuration status="INFO" name="cloudhub" packages="com.mulesoft.ch.logging.appender,com.kdgregory.log4j2.aws">
<Appenders>
.......
<CloudWatchAppender name="CLOUDWATCH">
<logGroup><logGroupName></logGroup>
<logStream><LogStreamName></logStream>
<rotationMode>daily</rotationMode>
<PatternLayout
pattern="[%d{yyyy-MM-dd HH:mm:ss.SSS}] %-5p [%t] %c - %m%n" />
</CloudWatchAppender>
<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>
.......
.......
<AsyncRoot level="INFO">
.......
<AppenderRef ref="CLOUDWATCH" />
<AppenderRef ref="CLOUDHUB"/>
.......
</AsyncRoot>
<AsyncLogger name="com.gigaspaces" level="ERROR"/>
<AsyncLogger name="com.j_spaces" level="ERROR"/>
<AsyncLogger name="com.sun.jini" level="ERROR"/>
<AsyncLogger name="net.jini" level="ERROR"/>
<AsyncLogger name="org.apache" level="WARN"/>
<AsyncLogger name="org.apache.cxf" level="WARN"/>
<AsyncLogger name="org.springframework.beans.factory" level="WARN"/>
<AsyncLogger name="org.mule" level="INFO"/>
<AsyncLogger name="com.mulesoft" level="INFO"/>
<AsyncLogger name="org.jetel" level="WARN"/>
<AsyncLogger name="Tracking" level="WARN"/>
.......
</Loggers>
The followings are the snippets of log4j.xml configurations for CloudHub 2.0 application.
.......
<Configuration status="INFO" name="cloudhub" packages="com.mulesoft.ch.logging.appender,com.kdgregory.log4j2.aws">
<Appenders>
.......
<CloudWatchAppender name="CLOUDWATCH">
<logGroup><logGroupName></logGroup>
<logStream><LogStreamName></logStream>
<rotationMode>daily</rotationMode>
<PatternLayout
pattern="[%d{yyyy-MM-dd HH:mm:ss.SSS}] %-5p [%t] %c - %m%n" />
</CloudWatchAppender>
.......
</Appenders>
.......
.......
<Loggers>
.......
.......
<AsyncRoot level="INFO">
.......
<AppenderRef ref="CLOUDWATCH" />
.......
</AsyncRoot>
.......
</Loggers>
Please skip this step if it's for CloudHub 2.0 application.
There are certain parameters that the AWS packages would require to be initialized before they can be executed. The authentication parameters are detailed in the link here.
# Custom AWS Cloudwatch Configurations
aws.region=<aws_region_example_us-east-1> aws.accessKeyId=<iam_user_access_key> aws.secretKey=<iam_user_secret_key>
Settings for CloudHub 1.0 application:
Settings for CloudHub 2.0 application:
After relaunching the Mule CloudHub application with recommended changes, the Cloudhub application must be able to push logs to AWS cloudwatch in the corresponding logging group and stream.
If you would like to forward logs from Hybrid on-prem applications to Cloudwatch, please refer to KB "How to send Logs from Mule Hybrid runtime to AWS CloudWatch?"
001116414

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.