Deleting Openfire Chat logs

I am running openfire 3.5.1 and everything works great! I’m using the archive plugin to archive all the messages that are sent back and fourth. I would like to clear the logs on a regular basis. I am using the builtin database and not mysql. Does anybody know how I can delete these archived messages? Or even better yet, to set it up so that it automatically clears the logs, say, every 30 days? Thanks in advance for the help guys.


are you using the `Jivesoftware Monitoring Plugin´ or another archive plugin?

With Jivesoftwares plugin there is no option to delete logs automatically and that’s really sad. You may want to vote for ENT-38 (even if this part of Openfire is now open source).

With the embedded database you need to shutdown Openfire to modify it. They should be stored in a table called “JIVEMESSAGEARCHIVE” (ENTMESSAGEARCHIVE for the Enterprise Plugin) and you may want to delete some of the “INSERT INTO JIVEMESSAGEARCHIVE VALUES …”. This is of course not a good solution, especially as the ‘CONVERSATIONID’ is used also in other tables which refer to this one. I hope that this does not cause null-pointer exceptions as one can use ‘Conversation State Archiving’ without ‘Message Archiving’.



Has anyone solved this problem or is it being worked on at all?

Seems that it is a bit nearsighted to think that your openfire server will hold every conversation in the log forever.

I have lots of disk…But after some time this just becomes a bit silly…At least have the ability to set a time limit to purge the logs to…Say options of 1 year or 3 months or something.

I turned this on to see how it works and well I can say that it can be usefull for abuse or complaints…But not at the cost of the amount of disk that will be eaten up over a few years time.

Also to go to the database and delete them from there manually…Does seem to work…But it has to be a bit cleaner than this.

Perhaps even a KB limit to save would work great…Or keep last 10000 conversataion

Anyhow just my 2 cents…At todays rates not too much anymore…


I did the following to delete chats for a user:

1)shutdown spark

2)make a backup of the db

3)copy the db to a different “work area” like /tmp/

4)Each chat “message” is an insert statement in the flat db file that looks like this:

Vi the db and look for the user’s chat that you wish to delete and note the spark client string next to it. For example, a pidgeon user’s INSERT may look like this:

find those strings. You can’t just delete all entries for that user b/c they won’t be able to use spark anymore and they’ll lose their “rosters”.

5)close the copied work db and execute a simple sed to see how many entries there are:

sed -n ‘/test@domain/a51c6a8e/p’ | wc -l

6)Execute another sed to confirm that you’re only capturing messages and no other sql statements.

sed -n ‘/test@domain/a51c6a8e/p’

7)Delete the chats with the following command:

sed -i ‘/test@domain/a51c6a8e/d’

8)Check the number of entries again to make sure you delete everything

sed -n ‘/test@domain/a51c6a8e/p’ | wc -l

9)copy this db back into place overwriting the previous flat file (that you backed up).

10)Restart openfire.

Now when you browse for this deleted user, you’ll still see the “conversation” but in the text area, it will say “The messages in this conversation were not archived.”

It’s not elegant but it works.