I’ve often wanted to look back at chat logs. Below are a few simple steps you can take to enable logging in IRSSI and add the log files to the logrotate daemon.
Make irssi log all chat windows:
# Create the directory
$ sudo mkdir /var/log/irclogs
$ sudo chown username:users /var/log/irclogs
#in IRSSI window
/SET autolog ON
/SET autolog_path /var/log/irclogs/$tag/$0.log
/save #answer 'yes'
#verify chats are logged (grouped by hostname)
$ ls /var/log/irclogs
freenode
Tell logrotate to auto-rotate them:
$ sudo vi /etc/logrotate.d/irssi
#paste into editor
/var/log/irclogs/*/*.log {
copytruncate
compress
notifempty
missingok
}
Test that log rotation works for a channel (ie: #xml on freenode):
$ sudo /usr/sbin/logrotate -d /etc/logrotate.conf
$ sudo /usr/sbin/logrotate -f /etc/logrotate.conf
$ cd /var/log/irclogs
$ ls -R
./freenode:
#xml.log #xml.log.1.gz