part of my slow release of software I wrote over the past decade that others may find useful

In high performance systems, it it often useful to serialize and externalize logging of values to a database table. This program permits client to send messages in JSON that will be logged to a database table.

There is no authorization, so it is very important this daemon runs on the loopback and isn't accessible to the outside world.

Messages will be accepted in the form (JSON):

    "table": {
        "fieldname": fieldvalue,
        "fieldname": fieldvalue,
        "fieldname": fieldvalue,

Project Link


Obtain mysql-python from:

tar -zxvf MySQL-python-1.2.3.tar.gz
cd MySQL-python-1.2.3
sudo python install

$ sudo easy_install python-daemon
$ sudo easy_install pyzmq

Also requires json, which I already had on my system, but you may not have on yours

You can test by running in the foreground with ./



Needs a MyISAM database table (or memory, or other which supports INSERT DELAYED).

mysql> create database etrelay_test ;
mysql> use etrelay;
mysql> create table vendor (datetime datetime, field1 varchar(50), field2 varchar(50), field3 varchar(50)) ENGINE = MYISAM;



$queue = new ZMQSocket(new ZMQContext(), ZMQ::SOCKET_PUB);

for ($i = 0; $i < 100; $i++) {
    $msg = array(
        'vendor' => array(
            'datetime' => time(),
            'field1' => sprintf("field1-%d", rand()),
            'field2' => sprintf("field2-%d", rand()),
            'field3' => sprintf("field3-%d", rand()),