Posts Tagged ‘logrotate’
[Gentoo] Logrotating emerge.log
By chys on April 4th, 2009It seems the reason why emerge.log is not logrotate‘d is that log analyzers (qlop and genlop) expect a full log. I’m not sure about qlop, but since I use only genlop, it seems okay to add it to /etc/logrotate.d – genlop supports reading logs from multiple files and also from compressed files (gzip and bzip2).
Create a logrotate configuration file. /etc/logrotate.d/emergelog:
/var/log/emerge.log {
compresscmd /bin/bzip2
uncompresscmd /bin/bunzip2
compressext .bz2
rotate 100
create 660 portage portage
delaycompress
daily
size 2M
}
I configured my logrotate to compress using lzma by default, but genlop recognizes only gz and bz2, so I need to explicitly specify bzip2 (or gzip) here.
A wrapper for genlop is also necessary. /usr/local/bin/genlop:
#!/bin/bash
f=()
for x in /var/log/emerge.log*; do
f=("${f[@]}" -f "$x")
done
exec /usr/bin/genlop "${f[@]}" "$@"
