[How-To] Save Chat log

Hi Community,

This is my first post doing a how to for the community so bare with me. Many of us need to record chat history for audit/review purposes. Although at the end the it’s a really straight forward process finding out the pieces and make them work was a challenge that took few days to figure out. I share this how-to to make it easier to people who need this functionality.

First you have to realize that everything is based on Prosody. You will have to do several changes and installs to make it work.

This works for Prosody .11 or newer

  1. Database option

First of all the recommended database to use is MariaDB (not MySQL). The reason is that prosody creates two tables automatically.

| Field | Type | Null | Key | Default | Extra |
| host | text | NO | MUL | NULL | |
| user | text | NO | | NULL | |
| store | text | NO | | NULL | |
| key | text | NO | | NULL | |
| type | text | NO | | NULL | |
| value | mediumtext | NO | | NULL | |


| Field | Type | Null | Key | Default | Extra |
| sort_id | int | NO | PRI | NULL | auto_increment |
| host | text | NO | MUL | NULL | |
| user | text | NO | | NULL | |
| store | text | NO | | NULL | |
| key | text | NO | | NULL | |
| when | int | NO | | NULL | |
| with | text | NO | | NULL | |
| type | text | NO | | NULL | |
| value | mediumtext | NO | | NULL | |

As you notice prosody use “reserved words (key,when,with)” that makes some SQL statements fail… I figure out his after reading lots of sql errors that make no sense until i saw the reserved words… once i installed MariaDB everything started to work. So MySQL is not an option if you want to use prosody with database storage.

The instructions to install mariaDB depends on the OS flavor your are using… but there are plenty of docs around. Just make sure the following:

a)Create a database called “prosody”
b)Create a user that has admin privileges to database “prosody”

  1. In order to make possible to prosody communicate with the database you need to install the LUA-DBI library. You can check more info about this here :


example in Debian:

apt install lua-dbi-postgresql

3)Configure prosody to be persistent.

Prosody has to be configured to use sql storage instead of memory or Internal (text files). This configuration is done in the .cfg.lua in Debian the path is:


Look for the area "Component “conference.” “muc” and change “storage” the following

storage = “sql”
sql = {
driver = “PostgresSQL”;
database = “prosody”;
port = 3306; – For databases connecting over TCP
username = “yourdatabaseuser”; – The username to authenticate to the database
password = “yourdatabasepassw”; – The password to authenticate to the database

  1. In the same are "Component “conference.” “muc” add in the area modules the mum_mam plugin it should look like this:

modules_enabled = {

  1. There are options of the module “muc_man” that have to be present check for options
    mod_muc_mam – Prosody IM but the most important is

    muc_room_default_persistent = true
    sql_manage_tables = true

The default is FALSE so what happens is that the messages are stored in the database only during the conference is active. Once everybody logoff the messages get erased from the database as well.

  1. Restart PROSODY and look logs for errors.

There are plenty of options to make the messages available for a period of time (1 week, 1 month, always) , the amount on messages show as history in case you reuse a conference room name etc etc.

As i said this is not something too hard but at least for me was a challenge.

Hope this helps



You said “Prosody has to be configured to use sql storage instead of memory or Internal (text files).” Can you please tell me how to access these text files. Also can you please tell me isn’t it possible to set chat messages persistent when we configure storage as internal?


Here is the complete you can have a look on storage backend


Intermal files are here


I imagine that if you want you can use internal and persistence mode but for me its not useful as if you want to search chats you Will need to GO manually… nevertheless should be posible to use …

Hope this helps

1 Like

thanks for the information but it says we could find the files in the folder /var/lib/prosody. But here there are only some config files and certificates. There are no chat messages.


if it’s true, your install is not working, since there should be at least 2 subdirectories having names encoding your existing hosts. When using muc_mam, chat files are stored in a subdirectory, not directly in the top directory.

Can u share your prosody config file ?

Did you restart it After doing changes?

I added the config file.
jitsi.example.cfg.txt (4.8 KB)

yes you are right. Actually there are some subdirectories. But I couldn’t find the text files including chat messages.

well, a how-to is here to b read and used. If you don’t follow it, it will not work.
Searching for the string ‘mam’ in your prosody config file brings nothing. So the item 4) of the how-to has not been applied.


thanks I found the files after enabling muc_mam module



is this under docker container path? I am not finding any folder or files in this path after enabling muc_mam. and setting storage = internal.
Please help

hi. what is the difference between mod_mam and mod_muc_mam.
I am kinda confused which is the module for save chat log in server side.