How to send Apache error.log to debugchannel

DebugChannel.com is a great new service / downloadable server to help debug your web application. The key things are that it speeds up debugging because all your debug output can be clearly formatted and shown in the same place. So you can get debug information from php scripts or even apache error logs. This post shows you how to send your Apache error logs or even Apache access lots to a debugchannel server.

Step 1 – Download the debugchannel tail client called dctail. This small python script is a wrapper for the the Linux tail command to watch files and send them up a debugchannel server.

wget https://github.com/debugchannel/debugchannel-tail-client/archive/master.zip

Step 2 – Extract the download and run the installer script which will install the command in /usr/bin/local/dctail and also create a service script in /etc/init.d/. This allows you to run dctail as a service on Ubuntu.

unzip master.zip

You need to run the installer script as root.

sudo ./install.sh

Step 3 – Setup the configuration files. The installer script creates a configuration files in /etc/debugchannel/dctail.conf . This is a json files. The key things to specify are the debugchannel server and which files you want to watch. To watch an Apache error.log you might need want a configuration file like this:

{
    "address": "https://debugchannel.com",
    "apiKey": "someApiKey",
    "files": { "/var/log/apache/error.log":"apachelogs" }
}

Note: we are sending the /var/log/apache/error.log -> https://debugchannel.com/apachelogs

Step 4 – Start running dctail as root (because it need permissions to read the Apache error.logs. You can either run it once using:

sudo dctail

Or (in Ubuntu) as a service

sudo service dctail start

I hope this helps someone.