-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add a daily cronjob emergency deletion of logs/files #75
base: master
Are you sure you want to change the base?
Conversation
This script checks the root filesystem disk usage and delete log files and a number of files upon a critical or critical disk space usage of the root filesystem.
I don't think deleting OS files like this is a good way to handle this type of situation. This can lead to the system being in an inconsistent state (for example now manpages don't exist anymore) or it could delete certain log files on which services have open handles on, leading to errors in the application. I think the better solution for future versions to have a better file system layout where the data files are on a separate partition than the OS files. Edit: also how much space are we really going to save by deleting the logfiles and the manpages? Note: critical levels of usage for ooniprobe related files is already implemented in ooniprobe itself and the quota is checked every hour. |
This script will delete older log files and unneeded OS system files (some of these files are being already deleted upon the build of the image see: https://github.com/TheTorProject/lepidopter/blob/master/lepidopter-fh/cleanup.sh). @hellais try it at your Pi you will surprised of how much disk space it will free up. We are using this script as a safeguard in order not to end up with clattered disks that will make lepidopter unresponsive and stop providing ooniprobe reports. |
Just ran this on a lepidopter that has been running for may months now and I get this:
All it all it seems like it cleans up less than 80 MB of data of which 71 MB the apt-get cache. It seems like this is just shifting the problem forward and it will not really give a raspberry pi that is in critical state much more mileage (80 MB is about 1 days worth of ooniprobe measurements) at the cost of risking to break other system services. |
Initially my idea as discussed with @bassosimone was to delete or archive ooniprobe reports, since ooniprobe is taking care of this I decided to not instruct the emergency deletion process to remove any ooniprobe reports. @hellais as I mentioned already the emergency cleanup will not be activated if the quota functionality in ooniprobe-agent is working as expected. This script ensures that lepidopter will not be brought in a state that is impossible to recover without user intervention. These files in #75 (comment) are already being deleted during the build-up process to reduce disk space in lepidopter's final image. If we decide to drop this and take our risks I would like to know at least how well the quota enforcement is working and if it has been at all tested? |
I suggest we instead go for an approach where we enable log rotation for ooniprobe logs. In the past there were some issues with using logrotate in ooniprobe due to the fact that the logrotation of twisted was competing with the logrotate. In https://github.com/TheTorProject/ooni-probe/pull/664 this should be resolved. I would suggest we test if this feature does in fact work as expected and if so include log rotation for ooniprobe as well in later versions. |
This script checks the root filesystem disk usage and delete log files
and a number of files upon a critical or critical disk space usage of
the root filesystem.