Quickly start logging of user chat log messages in Jabber Server

by jagbir on June 28, 2011

Here are the steps I’ve taken to turn on user chat logging for a jabber server. Please note that this way is not very efficient as it logs chats in plain html file. Logging into database might be more suitable for you.

Step 1: Checkout jabber modules
User chat logging in plain html files are provided by jabber module mod_log_chat. We are going to checkout jabber modules by using subversion client (svn). Make sure you have subversion client installed before proceeding

$ cd /usr/src
$ svn co https://svn.process-one.net/ejabberd-modules
$ cd ejabberd-modules/mod_log_chat/trunk/

Step 2: Compile mod_log_chat
We will compile and install mod_log_chat module. Make sure you have erlang installed for compilation purpose.

$ erl -pa ../../ejabberd-dev/trunk/ebin -make

Step 3: Install the module and update jabber configuration
After compilation, you need to put resultant .beam file to jabber’s ebin directory (usually /usr/lib/ejabberd/ebin/ but confirm) and update the jabber config file to recognize it:

$ cp ebin/mod_log_chat.beam /usr/lib/ejabberd/ebin/

Step 4. Create directory and update config
Create new directory to store chat logs and update jabber configuration to recognize new module. Directory should be owned by jabber user (usually ejabberd).

$ mkdir /var/log/jabberchat
$ chown ejabberd:ejabberd /var/log/jabberchat
$ vim /etc/ejabberd/ejabberd.cfg  ## add below line in file, make sure it's not under boundry (brackets) of other module
{mod_log_chat,  [{path, "/var/log/jabberchat/"}, {format, html}]},

save and exit from file.

Step 5: Restart Jabber and confirm logging is happening

$ ejabberdctl restart

Generate some chat and check the chat log directory, there should be some file(s) created having chats in html format. Installation completed. I would recommend you to read README file of module, it can be found in ejabberd-modules/mod_log_chat/trunk/ directory in case you have any issues or post a comment here.

You might also like to read following related helpful articles:
* Install and configure ejabberd IM server
* Upgrade to latest Apache in Linux
* Download, Compile and Install latest PHP
* 5 steps to secure your Linux Server
* Quickly install java/ant/ivy/red5 in Linux
* Ensuring secure access to prod Linux hosts
* Disable SSL v2 in Apache for PCI compliance

  • Kenneth Verbeure

    thanks man, this helped me a lot

  • piyush.ag

    server started properly
    but i can’t see any messages saved in my /var/log/ejabberd/chat directory

Previous post:

Next post: