Jelle van der Waa bio photo

Jelle van der Waa

I'm a software developer at Kopano and an Arch Linux Developer...

Email Twitter Google+ LinkedIn Github Steam

Today I noticed my Weechat logs have grown a lot! ~/.weechat/logs has grown to 360M. Obviously I need some sort of automation to take care of these logs, enter logrotate. Luckily Earnestly showed me how to use logrotate on it’s own some time ago. So all I what was needed was a logrotate config file (similiar to /etc/logrotate.d/*) and a systemd user service file. First off the ~/.local/share/logrotate.d/irc.

# weechat logrorate file

# Log files.
"~/.weechat/logs/**log" {}

The systemd service file located in ~/.config/systemd/user/weechat-rotate.service.

Description=Logrotate weechat's logs

ExecStart=/usr/bin/logrotate -s %t/logrotate.state %h/.local/share/logrotate.d/irc -v


Logrotate will run when Systemd reaches, more info about can be found here. You could also use a Systemd timer to schedule the logrotate weekly or monthly. To view log output use journalctl.

journalctl --user -f -u weechat-rotate