Is there any (NC-internal) way to enable logfile compression? I noticed nextcloud.log gets rotated, but not compressed. That is wasting of disk space, as in my case ~1.2GB nextcloud.log could be compressed by gzip to ~330MB.
This should be done by script that takes care of logfile rotation, but there is nothing NC-related in system-wide /etc/cron.daily (hourly, weekly, monthly). So NC is rotating logs on its own, but I could not anything in cron.php…
Why not this way?
# If fail2ban runs as non-root it still needs to have write access
# to logfiles.
# create 640 fail2ban adm
create 644 www-data www-data
You can test by running: logrotate -f /etc/logrotate.conf
The first run will create a nextcloud.log.1, the secong run will create a nextcloud.log.1.gz and so on …
As I wrote, logfile rotation is done somewhere in NC. If it were not, I’d create my own script for it. But I do not think it is a good idea to handle log rotation on two places. It might create some racing condition, file locking problems, etc.
IMHO, nextcloud is not able to compress the logs, i did not find any information about this here: Logging — Nextcloud latest Administration Manual latest documentation
That part of manual says nothing about log rotation, but if NC is able to rotate own logfiles (rename logfile to different name and create new one), it should be able to compress it too (i.e. by using some php compression wrapper).
PHP modules zip/zlib are listed as required for NC installation, so they could be used for it…
A default nextcloud installation will log to nextcloud/data/nextcloud.log, or where your data directory is. That will limit your logging capabilities to what is written into nextcloud, which is, IMO, ok but not great.
And there is a reason why they didn’t go all out on developing a first class logging facility – there is no reason to when you most likely have a proper logging facility built into your system already. You just need to make proper configurations to use it.