Disable log compression on new installations when /var/log is on ZFS dataset with compression enabled
The default setting for log compression is currently bzip2 for all cases, which isn't ideal for every case. If /var/log is on a ZFS dataset with compression, there isn't a compelling reason to have the logs also be compressed on rotation. ZFS is smart enough to not compress already compressed files, but it still seems inefficient and wasted effort since it's easier for users to have the log files uncompressed rather than having to read/search them using compression-related tools (e.g. bzcat, bzgrep, etc.). There are also reports from users in these cases that with large log files operations such as displaying the logs in the widget and searching are slow when using log compression.
On a fresh installation we could check if /var/log is on a ZFS dataset with compression enabled and automatically disable log compression on rotation in that case. The same should not be done post install as a user may deliberately want to set it for various reasons.
We may also want to disable log compression on specific slower hardware/disks but those cases are not as easily identified.
Updated by Jim Pingle about 2 months ago
I thought perhaps I could have the default be assumed as 'none' with ZFS but in practice that didn't go as well as I'd hoped. For fresh installs it was fine, but if someone already had ZFS and upgraded in-place, the log compression type switched and didn't work out as well. So there are two ways to proceed:
- Keep going this way, but also add upgrade code to reset the logs (a bit of a POLA violation)
- Explicitly set the type only during the very first boot before logs are configured
The second option is probably going to end up being easier and better for users in the long run.