Phabricator log rotation

In this article, I will give an example of configuring Phabricator log rotation.

Let’s see the list of logs, their size, rights and owner:

ls -l /var/log/phabricator/

For example, in the article below I showed how to create log files:
Install Phabricator on Ubuntu

touch /var/log/phabricator/access.log
touch /var/log/phabricator/ssh.log
touch /var/log/phabricator/daemons.log
chown phd:phd /var/log/phabricator/daemons.log
chown vcs-user:vcs-user /var/log/phabricator/ssh.log
chown www-data:www-data /var/log/phabricator/access.log

Create a log rotation file and open it in any text editor:

nano /etc/logrotate.d/phabricator

Here is an example of content:

/var/log/phabricator/access.log {
    daily
    missingok
    rotate 7
    compress
    delaycompress
    notifempty
    create 640 www-data www-data
}

/var/log/phabricator/daemons.log {
    daily
    missingok
    rotate 3
    compress
    delaycompress
    notifempty
    create 640 phd phd
}

daemons.log can contain a lot of information when debug is enabled or when errors occur, so I reduced its storage time to 3 copies, also the files have different owners and groups.

To test the log rotation script, let’s do a test run of logrotate and check the log files:

logrotate --force phd
ls -l /var/log/phabricator/

If you have a web server running on behalf of another owner or phabricator, then make sure that you have specified everything correctly and phabricator can restart successfully:

cd /home/phd/phabricator
./bin/phd status
./bin/phd restart

service phd status

Leave a comment

Leave a Reply