Archive for September, 2009

Logging IRSSI and Rotating them with Logrotate

Tuesday, September 8th, 2009

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
VN:F [1.8.4_1055]
Rating: 4.0/10 (2 votes cast)
VN:F [1.8.4_1055]
Rating: 0 (from 0 votes)