-
Notifications
You must be signed in to change notification settings - Fork 670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logging - limit disk usage of logs/<username>.sqlite files, remove old records #2822
Comments
I think it would be great to be able to limit the messages by how old they are. |
Or the other way around. Add function to clear history. Something like clear browsing history in browsers. Clear message history older than: . |
For the record, this type of query could be used for deleting n days of logs (the example deletes messages that are over 1 year old). delete from messages where time < strftime('%s', datetime('now', '-365 day'))*1000; |
Agree. I already tried that on my OpenShift deployment -> sqlite dies while executing the query... But I assume it's because resource limits. |
Any news about this topic? I've deployed thelounge in a docker container and trying to get rid of some messages to reclaim some space back. How can i execute this command "delete from messages where time < strftime('%s', datetime('now', '-365 day'))*1000;" to sqlite? Commandline? |
Latest pre-release has the feature to clear history of a channel. |
Would be great to have an option to set maximum amount of lines per channel to log - currently having troubles with fast growing log-files |
Yes, you need to use |
@alekna Hi, thanks for the follow up! Just checking if I understand this correctly, this is what I assume:
Did I get that right? |
@richrd, not exactly. Have a look at https://www.sqlite.org/fileformat.html and https://sqlite.org/lang_vacuum.html if you're curious. |
This feature is highly needed. If you connect to one of those torrent channels where messages are constantly piling up 24/7 you reach 1gig of logs withing a week. Running Lounge on Rpi bricks it within a month. |
I tried the "clear history" of a channel feature, but I'm not sure it's actually cleaning the sqlite database... It's still more than 600Mo on my side although I actually cleared everyone of my channel's histories |
That is expected, you can try to vacuum the database. Please see: https://sqlite.org/lang_vacuum.html |
Will take a look, thanks
Le mar. 16 févr. 2021 à 00:36, Kristian Klausen <notifications@github.com>
a écrit :
… That is expected, you can try to vacuum the database. Please see:
https://sqlite.org/lang_vacuum.html
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2822 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABSPF2TYVPDRW44ID4AA6TS7GVYVANCNFSM4FYWH4SA>
.
|
+1 - I got several gigabytes of logs and I would like to get rid of them natively without having to do it manually |
Maybe thelounge could do that periodically for all databases? |
A temporary workaround could be to use logrotate to archive log-databases when they grow too big. |
I am looking for a solution that doesn't require me to stop thelounge to clean up logs |
Any updates or working workaronuds for this? I'm running an instance with several users and the |
Sure: https://github.com/thelounge/thelounge/wiki/Purging-logs-older-than-X-days is a workaround that does just that. |
Is there interest in this feature if someone else provides a solution. I can think of two ways to implement this:
|
Triggers are the wrong tool for the job in this case would be my guess, especially as you want to make this configurable and somewhat dynamic. I'd also like to have the ability to only delete status messages, while keeping the important stuff like privmsgs around. My plan is to limit this to N rows per iteration |
Adds a new config `dbHistoryDays` which defaults to undefined. At start up, each database handler reads the config. If the value is set, then a reoccuring task is scheduled to clean up old events. Events older than `dbHistoryDays` are targeted but only a few thousand events are cleaned up per iteration to avoid freezing the server. Adds unit tests to validate the cleanup logic as well. Fixes thelounge#2822
Adds a new config `dbHistoryDays` which defaults to undefined. At start up, each database handler reads the config. If the value is set, then a reoccuring task is scheduled to clean up old events. Events older than `dbHistoryDays` are targeted but only a few thousand events are cleaned up per iteration to avoid freezing the server. Adds unit tests to validate the cleanup logic as well. Fixes thelounge#2822
Feature Description
Currently, there's no way how to control logs/.sqlite file size. It can grow forever. Although this is usually not an issue, it will be good to have a mechanism that will keep file size under control.
Use-cases
Ideas
The text was updated successfully, but these errors were encountered: