以下の設定をlogrotate.confに書き込む。
compresscmd /bin/bzip2 compressoptions --best compressext .bz2
結局以下のようなlogrotate.confになる。
$ cat logrotate.conf
compresscmd /bin/bzip2
compressoptions --best
compressext .bz2
/var/log/hoge.log {
compress
}
出来たファイルが圧縮されていることをfileコマンドで確認。
$ file /var/log/hoge.log* /var/log/hoge.log: UTF-8 Unicode text /var/log/hoge.log.1.bz2: bzip2 compressed data, block size = 900k