Setting up ejabberd and bandersnatch for xmpp chat logging
Over the past few days I've been researching XMPP/jabber servers with a plan of integrating live chat into our CRM. I've decided to go with ejabberd because of it's scalability and robustness. There are allot of options out there, but I won't go into that right now. I just want to give a brief overview of the steps it took to get ejabberd working, along with the bandersnatch component that enables logging of chat messages to mysql.
Firstly a couple of links to the home pages of the two projects:
http://www.process-one.net/en/ejabberd/
http://www.funkypenguin.info/project/bandersnatch/
Installing ejabberd was very simple. It doesn't include setting up a system daemon, but include a daemon script that can be setup manually.
1. download ejabberd binary
2. extract and chmod +x
3. run the binary: $ sudo ./ejabberd-2.1.1-linux-x86-installer.bin
4. follow the prompts
5. start ejabberd $ /opt/ejabberd-2.1.1/bin/ejabberdctl start
6. Browse the admin page: http://127.0.0.1:5280/admin
7. Read the docs: http://127.0.0.1:5280/admin/doc/guide.html
I managed to get bandersnatch working eventually, but it was a bit of a mission. The application archive on the home page was corrupted, but I managed to find it on a mirror site. It's poorly documented and hasn't had much activity since 2008, but it does work. It logs private and group chat to mysql. Attached is a screenshot of the logs it has recorded in few brief tests i ran.
1. download the archive (attached)
2. extract to /opt/bandersnatch
3. modify /opt/ejabberdETC/conf/ejabberd.cfg
add this in the modules section:
{mod_service_log, [{loggers, ["bandersnatch.jabber.myserver.com"]}]}
add this in the listeners section:
{5526, ejabberd_service, [{ip, {127, 0, 0, 1}}, {access, all},
{hosts, ["bandersnatch.jabber.myserver.com"],
[{password, "secret"}]}]},
4. create the bandersnatch db in mysql and run the db install script
mysql -u root -p bandersnatch < bandersnatch.sql
5. modify /opt/bandersnatch/config.xml setting the secret and component name
<server>
<connectiontype>tcpip</connectiontype>
<hostname>localhost</hostname>
<port>5526</port>
<secret>secret</secret>
</server>
<component>
<name>bandersnatch.jabber.myserver.com</name>
</component>
6. install the perl dependencies:
$ apt-get install libnet-jabber-perl
7. Run bandersnatch from /opt/bandersnatch
$ perl bandersnatch config.xml
Below are a few links I used to put this all together.
http://www.ejabberd.im/install-bandersnatch
http://gonzo.kiev.ua/projects/jabber/bandersnatch-en.html
file:///opt/bandersnatch/doc/bandersnatch.html
Setting it up as a daemon
http://ubuntuforums.org/showthread.php?t=67918
Also it's worth pointing out that this is just a test and not a production setup. The environment I ran it on is Ubuntu Hardy 8.04 LTS Desktop.
- Jason's blog
- 1410 reads


Comments
Bandersnatch Archive
I cannot find the "attached" bandersnatch tarball. Could you provide some directions on how to get it, please?
bandersnatch tar
Hi Dan,
I couldn't find it on the bandersnatch home page, but found it through a mirror site or something. Can't remember the link off hand. I've attached a copy here so you could use that one if you want.
Post new comment