Fluentd is an open-source data collector software that can be used to route and process application logs. The mule services and applications running on them can also be configured to forward logs to Fluentd service for further process
Step 1: Make changes to the log4j.xml to include the classes that are required for the service to push forward the logs. (The below sample uses packages wycore_log4j-plugin-fluency and komamitsu_fluency to demonstrate the functionality. Check the links for the latest information and further configurations)
<?xml version="1.0" encoding="utf-8"?>
<Configuration packages="com.wywy.log4j.appender,org.komamitsu.fluency.Fluency">
Step 2: Include the changes in the log4j.xml for Fluentd related configurations. Also, configure the AsyncRoot for the new fluentd appender.
.....
.....
.....
<Appenders>
<Fluency name="fluency" tag="yourTag">
<!-- all settings are optional, see defaultFluency() for default values -->
<!-- you can add as may fields as you like (or none at all) -->
<StaticField name="application">yourApplication</StaticField>
<StaticField name="someOtherField">some value</StaticField>
<Server host="primary-node" port="24224"/>
<Server host="secondary-node" port="24224"/>
<FluencyConfig
ackResponseMode="true"
fileBackupDir="/tmp/fluency"
bufferChunkInitialSize="4194304"
bufferChunkRetentionSize="16777216"
maxBufferSize="268435456"
waitUntilBufferFlushed="30"
waitUntilFlusherTerminated="40"
flushIntervalMillis="200"
senderMaxRetryCount="12" />
</Fluency>
</Appenders>
.....
.....
<AsyncRoot level="INFO">
......
......
<AppenderRef ref="fluency"/>
......
......
</AsyncRoot>
For Mulesoft Application logs, the "log4j.xml" wrapped in the application must be updated.<dependency> <groupId>com.wywy</groupId> <artifactId>log4j-plugin-fluency</artifactId> <version>1.3.2</version> </dependency>For Mulesoft Service[mule_ee* logs], Identify and collect all the dependent jars and place them in the file system[For example, {MULE_HOME}/lib/user/] where mule is installed. Then edit the "wrapper.conf" file to include that path to load the fluentd service-related jar files.
wrapper.java.classpath.<n>=<PATH TO THE FOLDER CONTAING JAR FILES>/*.jar
Step 4: Restart the mule application/service to make sure the changes are effective, no errors are reported.
| Common Errors | Cause | Solution |
|---|---|---|
WebSocketInboundExecutor ERROR Appenders contains an invalid element or attribute "Fluency" WebSocketInboundExecutor ERROR Unable to locate appender "fluency" for logger config "root" | This error occurs when the libraries are not identified by the running service or application. | Check of the required libraries are packaged/placed manually in the mentioned Step 3 |
Disclaimer: This example is provided as a reference for your own usage and is not to be considered a MuleSoft product. This example should be considered as a custom solution. The custom solution is not a Supported MuleSoft product.
001116589

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.