Add the Socket appender entry to log4j. For example:
<Socket name="socket" host="${sys:elk.host}" port="${sys:elk.port}" protocol="TCP">
<PatternLayout pattern="{"log_timestamp":"%d" ,"log_thread":"[%t]" , "log_level":"%-5p" , %m}%n" />
</Socket>
Note: "elk.host" and "elk.port" are the Elasticsearch server host and port to send the logging entries to. In the above example, you will need to pass the values as system properties. Add SSL information when needed. If the remote server is secured by TLS, please provide SSL configuration. The following example shows a 2-way SSL configuration where both truststore and keystore are configured:
<Socket name="socket" host="${sys:elk.host}" port="${sys:elk.port}" protocol="TCP">
<PatternLayout pattern="{"log_timestamp":"%d" ,"log_thread":"[%t]" , "log_level":"%-5p" , %m}%n" />
<SSL>
<KeyStore location="${sys:path}/elk.jks" password="changeit"/>
<TrustStore location="${sys:path}/elk.jks" password="changeit"/>
</SSL>
</Socket>
Configure the Mule application to log to the Socket appended within the log4j2.xml. For example:
<AsyncRoot level="INFO"> <AppenderRef ref="FILE" /> <AppenderRef ref="socket" /> </AsyncRoot>
001115078

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.