Getting arbitrary log files into Rsyslog

The key is the optional rsyslog module imfile. It’s not enabled by default, so you will need to enable it.

vim /etc/rsyslog.conf

# add the following
$ModLoad imfile

You will also need to configure each log file you want to poll. If you want, you can place these settings in separate files under /etc/rsyslog.d. In this case, my application is called “celery”.

vim /etc/rsyslog.d/celery.conf

# add the following
$InputFileName /var/log/django/celery.log
$InputFileTag celery
$InputFileStateFile celery-file1
$InputFileSeverity info
$InputFileFacility local7
$InputRunFileMonitor
$InputFilePersistStateInterval 1000

# exit vim, and restart rsyslog
service rsyslog restart

This will poll celery.log every 10 seconds, and echo the contents into syslog. You can then forward them to remote machines as necessary.

Could no open output pipe ‘/dev/xconsole’

Create /dev/xconsole and set its correct ownership and permissions:

sudo touch /dev/xconsole
sudo chgrp syslog /dev/xconsole
sudo chmod 664 /dev/xconsole

Restart the rsyslog service