processone / ejabberd

Robust, Ubiquitous and Massively Scalable Messaging Platform (XMPP, MQTT, SIP Server)
https://www.process-one.net/en/ejabberd/
Other
6.03k stars 1.5k forks source link

MAM delete messages after certain period of time #4009

Closed Musacca closed 1 year ago

Musacca commented 1 year ago

I would like my messages to be deleted from the archive table after 90 days automatically?. As I see, there is an API delete_old_mam_messages for deleting the old messages.

Is there any property that I can set in the ejabberd.yml file which will delete the messages after 90 days?

licaon-kter commented 1 year ago

https://github.com/processone/ejabberd-contrib/tree/master/mod_cron

badlop commented 1 year ago

Right, in fact there's an example that mentions that API in https://github.com/processone/ejabberd-contrib/tree/master/mod_cron#ctl

For example, this deletes everyday the messages that are older than 90 days:

modules:
  mod_cron:
    tasks:
      - time: 1
        units: days
        ctl: delete_old_mam_messages
        arguments:
          - "all"
          - "90"