How to back up logs

Logs in gajim are stored in a database, called logs.db. This page explains how to backup this database.

For more, read about the design of the database

This can be used to restore a malformed database.

For Linux

you need sqlite3 package to do that.

In a terminal, type that to backup your database:

sqlite3 ~/.gajim/logs.db .dump > backup.sql

To restore it, just remove (or move) your old database:

mv ~/.gajim/logs.db ~/.gajim/logs.db.old

then type:

sqlite3 ~/.gajim/logs.db < backup.sql

For Windows

You need sqlite3 command line tool ( precompiled binaries) to do that. In a command-line windows, type:

sqlite3.exe %appdata%\Gajim\logs.db
sqlite> .output C:\backup.sql
sqlite> .dump
sqlite> .quit

This will store the create and insert sql commands in C:\backup.sql

To restore the database, remove logs.db (or rename it to logs.db.old) from %appdata%\Gajim\logs.db (most probably C:\application data\YOUR_ACCOUNT\Gajim\logs.db):

rename %appdata%\Gajim\logs.db %appdata%\Gajim\logs.db.old

then type in a command-line window:

sqlite3.exe %appdata%\Gajim\logs.db
sqlite> .read C:\backup.sql
sqlite> .quit

View recent messages

So your computer crashed (ie. SysRq?+b) and Gajim is silent about all those previously unread messages. View the recent 100 with this query:

select logs.kind,jids.jid,logs.message from logs,jids where jids.jid_id=logs.jid_id and (logs.kind = 3 or logs.kind = 4) order by time desc limit 100;