History Commands#
synadm history#
Purge historic events from Synapse database.
synadm history [OPTIONS] COMMAND [ARGS]...
purge#
Purge room events before a point in time or before an event ID.
The purge history API allows server admins to purge historic events from their database, reclaiming disk space.
Depending on the amount of history being purged a call to the API may take several minutes or longer. During this period users will not be able to paginate further back in the room from the point being purged from.
Note that Synapse requires at least one message in each room, so it will never delete the last message in a room.
By default, events sent by local users are not deleted, as they may represent the only copies of this content in existence. (Events sent by remote users are deleted.)
Room state data (such as joins, leaves, topic) is always preserved.
The API starts the purge running, and returns immediately with a JSON body with a purge id. Use ‘synadm history purge-status <purge id>’ to poll for updates on the running purge.
synadm history purge [OPTIONS] ROOM_ID
Options
- -i, --before-event-id <before_event_id>#
Purge all history before this event ID. Event ID’s contain $, which is interpreted by the shell. Make sure it is surrounded by single quotes (‘id’).
- -d, --before-days <before_days>#
Purge all history before this number of days ago.
- --before <before>#
Purge all history before this point in time. Eg. ‘2021-01-01’, see above for available date/time formats.
- --before-ts <before_ts>#
Purge all history before this point in time giving a unix timestamp in ms.
- --delete-local#
This option overrides the default behavior and forces removal of events sent by local users.
Arguments
- ROOM_ID#
Required argument
purge-status#
View status of a recent history purge..
Provide purge ID as argument. The status will be one of active, complete, or failed.
synadm history purge-status [OPTIONS] PURGE_ID
Arguments
- PURGE_ID#
Required argument