[ejabberd] mod_log_remote: log to remote Erlang node

Hisham Mardam Bey hisham.mardambey at gmail.com
Thu Aug 23 08:01:44 MSK 2012

Hi folks,

As we do more things with Ejabberd we're writing a bunch of new
modules that we're using internally for our business logic and
whatnot. One module that I'd like to share with people is
mod_log_remote. We use this module (will be soon actually, its still a
work in progress) to perform certain logging operations. Since the
rest of our system runs on top of the JVM we've integrated Ejabberd
into it via the Erlang OTP Java libraries. mod_log_remote beams
logging information of events and messages as they take place to our
JVM Erlang/OTP nodes. These nodes transform the messages and push them
into Apache Kakfa (message queue) for processing.

We use mod_log_remote in our other Ejabberd modules too to log events,
as well as from the client side (we've got StropheJS running there) to
send <message> stanzas that will be intercepted and are destined to
log client side events. Here's the description from the code itself:

%% mod_log_remote is a simple Ejabberd module and gen_server that
%% allow for remote logging. It uses the filter_packet hook to
%% intercept <message> stanzas addressed to logger at vhost. These
%% messages are beamed off to the configured Erland node / pid in
%% the form:
%% {Type, LogTime, Payload}
%% where Type and Payload are specified by the caller and LogTime is
%% the time the module beamed off the packet.
%% mod_log_remote also pings the remote Erlang node at a specified
%% interval to alert the other side that it is still alive in case
%% no messages come through for a short period of time.
%% For other modules to log through this they need to call the:
%% log(Type, Payload)
%% function that will ship the log message out as specified above.


I'll be updating this module with additions and fixes as we do them
for others to benefit from as well. Hope folk can put this to good use
or base other code off of it.

Ejabberd rocks! (=


Hisham Mardam-Bey

More information about the ejabberd mailing list