Your Rocket.Chat version: 0.19.0
This is not an issue per se, but more of an enhancement request if possible.
It would be nice to have the ability to delete a chat's history, could be a room's history, or a 1 to 1 chat history. Totally, all messages displayed in a given room. Or delete all messages older than $DATE , or delete all messages between DATE1 and DATE2.
Could be that this feature is only available for server admins.
you can delete rooms (again - check #2351) - look:
Thanks sampaiodiego, that is nice to know. However, it would be very nice to have the ability, as an admin, to auto expire messages. Perhaps a system-wide setting to forget messages older than a given time period. Or, perhaps to forget messages once a user logs out. Or perhaps best of all, to never keep messages on the server at all.
Agree with this. Setting up auto-expiring channel history(like, daily, weekly) could be interesting in some cases. We are doing some integration of Rocket.Chat with Zabbix, and the channel that receives the notifications could be cleared from time to time to avoid long history and keeping daily notifications clean.
Meanwhile we can delete and recreate the channel from time to time, but we have to ask to all members to refresh their browsers since it keeps some of the old channel cache showing(and blocking new messages to be sent)
I recently installed a fresh version of Rocket.Chat and played a bit. To not need to recreate a channel everytime, there IS some need to cleanup the thread. Is it possible to just clean previous messages from some message/time? (Especially automatization-chats would benefit from this)
With a MongoDB Query you can delete all messages in the whole db "less than" a specific date.
db.rocketchat_message.remove( { ts: { $lt: ISODate("2016-08-01") } } );
It is not the best solution, but in our company we had to find a workaround until the developers add some cleanup features.
Another vote for this feature. We have a channel that logs a certain kind of exceptions from our sytems and those tend to be rather large - so the channel becomes very slow to load in short order.
Currently I'm deleting and recreating the channel on a regular basis, but that's not really a "solution"
is this something that is close to being usable the ability to remove all chat without having to remove the channel would be amazing or at least a way to clean the database...
+1 for this feature
+1 from me as well.
+1
The functionality I would like is slightly different, I'd like to clear DM's on logout
I could help test if needed
+1
Dear +1ers, you can just click on the first post and add your thumbs-up there. :)
Regarding the feature, I think it would be extremely useful to be able to choose between 1) delete permanently, or 2) archive (perhaps to S3?) then delete.
Dear +1ers, you can just click on the first post and add your thumbs-up there.
Yes but it wouldn't keep this thread alive nearly as well :)
Yes but it wouldn't keep this thread alive nearly as well :)
Thats no real reason, because it makes this thread just noisy.
As this project is pull-request friendly, maybe someone can create a PR instead of just +1-ing? I'm currently not (yet) able to develop, but I'm preparing to. Maybe I will fast enough to develop this feature (but I doubt it, because I'm not used to develop meteor-driven apps)
Added some thumbs up per suggestions :)
After digging around a bit, this feature seems to already exist:
https://rocket.chat/docs/developer-guides/rest-api/channels/cleanhistory
As far as I understood, this only is a missing button, am I correct?
EDIT: there is even some permission already: clean-channel-history
That seems to be only for channels, right? I believe this is for deleting other stuff, as well.
@mddvul22 looking at the sourcecode, it only is for channels:
https://github.com/RocketChat/Rocket.Chat/blob/bf65a13978e2dd165b1b4978597f6a90cba7666e/packages/rocketchat-api/server/v1/channels.js#L62
It does not work for private groups which you temporarily change to public channel for a minute, just to be able to use the api - so either this functionality needs to be duplicated for private groups, or it needs to be fixed so that the workaround works
I use the solution that that KKvin came up with but expanded upon it to clear the uploaded files that were part of the 30 day threshold as well. Not elegant but it gets the job done. Can be seen here:
https://github.com/chrisjd20/rocket_chat_history_clear
Just to cross-link: If you want retention policy rather than manual deletion, There's An Issue For That: https://github.com/RocketChat/Rocket.Chat/issues/795
Dang. lol. Thanks that is much easier.
On Sun, Mar 12, 2017 at 11:04 AM, Tim McCormack notifications@github.com
wrote:
Just to cross-link: If you want retention policy rather than manual
deletion, There's An Issue For That: #795
https://github.com/RocketChat/Rocket.Chat/issues/795—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/RocketChat/Rocket.Chat/issues/2355#issuecomment-285950437,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALQ9fwhJ3pKqJXbuEpa2029rR3IJlQU7ks5rlAmFgaJpZM4HjuX_
.
any progress on this?
just a reply for the issue in general. If we can make something in the admin panel to delete old message history.
+1 for automatically deleting
This is such an important feature to have... I would love to be able to set a policy per channel on how much in the channel is stored at x date. Say announcements channel stored everything for life and general for up to two months in the past.
+1
I need this too, for storage reasons. +1.
+1 would be helpful e.g. for clean up rooms with hubot postings
Ugh, almost 2 years later and this is still not a thing. :(
damn !!! We need this !!!
+1
+1!
+1 !
+1
I have programmed a quick fix for those that are waiting for the official feature.
I used the REST API in a php script. It can be ran manually or by chron.
You create a new Rocket Chat user and invite them to whatever channels you want to be cleaned regularly. You set how long you want the messages in those channels to last for. Right now it is set for 24 hours ("-1 days").
When it is ran (manually or by chron), iIt goes through all the channels (public and private, not direct messages) that the designated user is in and deletes all messages older than the designated time. It automatically ignores pinned messages. Base on my testing it also deletes the associated uploaded attachments of the messages. I have mine running every hour via a chron job.
@jberberick thanks, works great, really useful!
Even having some WORKAROUND, this should be part of the application itself :(
I'd be more than happy to work on this issue, but I'm not sure how to set up a development environment. If someone could point me to some documentation or guide.
As a work around, we use this shell script in crontab to delete all old messages (one month). However, this does not work on channel messages (we don't know where messages are store in mongo).
#!/bin/bash
DATE=$(date --date '1 month ago' +%Y-%m-%d)
mongo rocketchat --eval 'db.rocketchat_message.remove( { ts: { $lt: ISODate("'$DATE'") } } );'
mongo rocketchat --eval 'db.rocketchat_room.remove( { ts: { $lt: ISODate("'$DATE'") } } );'
mongo rocketchat --eval 'db.rocketchat_subscription.remove( { ts: { $lt: ISODate("'$DATE'") } } );'
mongo rocketchat --eval 'db.rocketchat_uploads.remove( { ts: { $lt: ISODate("'$DATE'") } } );'
Correction, it is working also on channels, but there must have probably a little cache on the client.
@sbonnegent Thanks for the update. We are doing the same thing, for content older than a week (except that we aren't removing rooms or subscriptions). And yes, in our experience, if a user leaves their RC application open, then older content will remain in their client window, even though it is gone from the server.
Based on my experience, deleting messages via REST API causes the client side to update automatically, so their is no issue with cached messages.
@MarcosSpessatto Right now we currently havechannel.cleanHistory
which utilities a real time method. It would be super easy to deprecate this endpoint and instead move over to rooms.cleanHistory
, that way any room is viable and not just the channels. Less than fifteen minutes of work is required as it's that simple. Just be sure to depreciate the channels endpoint.
We currently have the same issue in requiring a cleanup I ended up writing a python based script very similar in logic to the php script above however as we have to delete literally millions of messages and each of those requiring a seperate api call which took around a second to complete with the python request library this was impractical. and seemed to cause a massive load over an extended period of time. I am currently rewriting in hope of changing private groups to public and using the channels.cleanhistoryyes endpoint. however this is hacky I would much prefer a rooms.cleanhistory endpoint for bulk message deletion.
In case anyone else also needs this here is a script which can delete both public and private rooms using the api. https://github.com/HackyPenguin/rocketchat_cleanup/tree/master
Same requirement here ...
We need a channel / room that we can set an expiration period for the messages in this channel/room.
To second this feature, we also have that requirement not for technical but legal reasons.
Background: in Germany (and probably other countries) data protection law requires to define a maximum storage time for data. That means we need a reliable way to set an expiry date (e.g. "after 5 years") on all content in all channels.
Ideally there's a global setting as well as by channel settings, to allow a faster purge for automation channels.
@rsimai not only germany, with the upcoming GDPR (General Data Protection Regulation) the whole EU is having "new" data protection laws, making the whole history-thing a bit more painful than it might have to.
@FibreFoX "upcoming"... as in... the 25th of May 2018! As far as I understand GDPR we will have to have the ability to automatically delete messages after a specified time or upon user request.
Is there anything new to this, or information about when it will be implemented?
We are having the same issue here in our office, the new EU Law for data protection is really painful.
Did anyone automated the channel history deleting process and can share it with us?
@eszeus There is the REST API call rooms.cleanHistory
. I might make a PR to implement a GUI for it, in the channel buttons though, to make this easier (and possibly make it automatically stage it so you can tell the process is happening, as cleaning a large channel may take ages)
@vynmera Any Automated process would be awesome! Specially with a GUI. I am not an expert with APIs and such, sadly...
I'm making it happen! ---> #11236
@vynmera that's pure awesomeness! How can I deploy it? Has it been merged to master? Don't know much about git!
@wdimd You can clone my fork git clone https://github.com/vynmera/Rocket.Chat.git
, go to it cd Rocket.Chat/
, then go to my branch git checkout purge
, and deploy it with meteor npm start
. For more info on how to deploy a development version, check this out: https://rocket.chat/docs/developer-guides/quick-start/
Note that it's a WIP build, don't expect everything to work correctly (or at all). I _highly_ advise you to not use it in production :)
When I update anything, you can git pull
to download the newest version.
Thanks @vynmera, keep rocking!!!
@vynmera also deployable via snap installation? :D
@eszeus I'm afraid not, it's not done yet ~ but when it is, you can start using it once it is on Rocket.Chat's snap (probably next month, at 0.67.0)!
@vynmera so nice! Thanks! Sounds great to me :D Thank you for this work. Awesome, and neccessary xD
Most helpful comment
Thanks sampaiodiego, that is nice to know. However, it would be very nice to have the ability, as an admin, to auto expire messages. Perhaps a system-wide setting to forget messages older than a given time period. Or, perhaps to forget messages once a user logs out. Or perhaps best of all, to never keep messages on the server at all.