29 Gb log file? Why does Longview not rotate/clear logs?
I was hunting down a disk space issue on one of my Ubuntu VPS servers today and found the Longview log file was over 5Gb. This led me to go through my other 7 VPS and I found various large sizes, but on my oldest linode VPN (~4 years) it was…… 29G!
Why does Longview not implement it's own log cleanup or logrotate entry? There's nothing in the install docs about needing to manually maintain this file.
Others large ones were 3G, 6G & 13G.
du -sh /var/log/linode/longview.log
29G /var/log/linode/longview.log
1 Reply
Yeah, it is a little odd there is not more mention of the potential for file accumulation on a machine utilizing Longview.
I am assuming that the logic behind not including a log cleanup solution out of the box is because most people who are installing Longview want the data that is being collected so they can reference historical trends or averages over a long period of time. But there are certainly limits to how long data is useful/relevant.
Whatever the reason is, I know that solutions (such as logrotate) exist, and adding a few lines to a configuration file to automate the logfile management can be done.
Looking over a guide for managing logfiles with log, I found this:
https://betterstack.com/community/guides/logging/how-to-manage-log-files-with-logrotate-on-ubuntu-20-04/
In short, you should be able to add some lines to the logrotate conf file, like below:
/path/to/add/*.txt {
daily
rotate 5
}
You would just need to specify the path (and obviously change the frequency from daily to a much longer timescale) to longview's log directories, and it should do the trick.
I know this does not really answer the why in your initial question, but it should at least address the solution to the issue.
I hope that helps!
-Micah