Get a DemoStart Free TrialSign In

Mulesoft

Ship Mule application logging entries to Logstash and Elasticsearch using Socket Appender

Use AnypointStudio and configure log4j using Socket Appender to ship Mule application logging entries to Logstash or Elasticsearch.

Follow this step by step guide to get 'logs' from your system to Logit.io:

Step 1 - Locate your log4j2.xml file

In Anypoint Studio you can configure your log4j2.xml file under the location src/main/resources.

Step 2 - Configuring log4j2.xml

You will need to add the Socket appender to the log4j2.xml file. Under the RollingFile tag, inside the Appenders tag add the following snippet swapping the variables for the:

<Socket name="socket" host="your-logstash-host" port="your-ssl-port" protocol="ssl">
<PatternLayout pattern="{&quot;log_timestamp&quot;:&quot;%d&quot; ,&quot;log_thread&quot;:&quot;[%t]&quot; , &quot;log_level&quot;:&quot;%-5p&quot; , %m}%n" /> 
</Socket>

Then inside the tag AsyncRoot level="Info" you will need to add:

<AppenderRef ref="socket" />

After adding these two snippets to your file your log4j2.xml file it should look like the example below:

<?xml version="1.0" encoding="utf-8"?>
<Configuration>
    <Appenders>
        <RollingFile name="file" fileName="${sys:mule.home}${sys:file.separator}logs${sys:file.separator}test.log" 
                filePattern="${sys:mule.home}${sys:file.separator}logs${sys:file.separator}test-%i.log">
            <PatternLayout pattern="%d [%t] %-5p %c - %m%n" />
            <SizeBasedTriggeringPolicy size="10 MB" />
            <DefaultRolloverStrategy max="10"/>
        </RollingFile>
        
        <Socket name="socket" host="your-logstash-host" port="your-ssl-port" protocol="ssl">
        <PatternLayout pattern="{&quot;log_timestamp&quot;:&quot;%d&quot; ,&quot;log_thread&quot;:&quot;[%t]&quot; , &quot;log_level&quot;:&quot;%-5p&quot; , %m}%n" /> 
        </Socket>
        
    </Appenders>
    <Loggers>
        <!-- CXF is used heavily by Mule for web services -->
        <AsyncLogger name="org.apache.cxf" level="WARN"/>
        
        <!-- Apache Commons tend to make a lot of noise which can clutter the log-->
        <AsyncLogger name="org.apache" level="WARN"/>
        
        <!-- Reduce startup noise -->
        <AsyncLogger name="org.springframework.beans.factory" level="WARN"/>
        
        <!-- Mule classes -->
        <AsyncLogger name="org.mule" level="INFO"/>
        <AsyncLogger name="com.mulesoft" level="INFO"/>
        
        <!-- Reduce DM verbosity -->
        <AsyncLogger name="org.jetel" level="WARN"/>
        <AsyncLogger name="Tracking" level="WARN"/>
        
        <AsyncRoot level="INFO">
            <AppenderRef ref="file" />
            <AppenderRef ref="socket" />
        </AsyncRoot>
    </Loggers>
</Configuration>

Step 3 - Check Logit.io for your logs

Data should now have been sent to your Stack.

View my data

If you don't see logs take a look at How to diagnose no data in Stack below for how to diagnose common issues.

Step 4 - how to diagnose no data in Stack

If you don't see data appearing in your Stack after following the steps, visit the Help Centre guide for steps to diagnose no data appearing in your Stack or Chat to support now.

Step 5 - Mulesoft Logging Overview

MuleSoft is the creator of a widely used IPaaS (integration-platform-as-a-service) that assists businesses with connecting data, devices and apps across cloud platforms and on-premise services. This solution helps create a unified single-pane in the observability of key processes and applications across the enterprise.

Mule’s technology has allowed them to become a market leader among other integration tech suppliers in this space. Their popularity continues to grow among IT teams prioritising digital transformation & modernisation within their organisation.

Their AnyPoint Platform generates both runtime & application logs to help users troubleshoot activity from the MuleSoft server. These can be shipped to the Elastic Stack & visualised in Kibana to help administrators monitor errors, create dashboards & visualisations, as well as alert on irregularities in application activity.

Log data generated from running Mule servers can be centralised and managed using Logit.io as both platforms are built to work hand in hand to help your business become scalable & ready for growth.

If you need any further assistance with migrating your Mule log data to Logstash we're here to help you get started. Feel free to reach out by contacting our support team by visiting our dedicated Help Centre or via live chat & we'll be happy to assist.

Return to Search
Sign Up

© 2024 Logit.io Ltd, All rights reserved.