postlog

Driver for storing log data into PostgreSQL database. More...

Driver for storing log data into PostgreSQL database.

The postlog driver is for storing log data into given tables of given PostgreSQL database.

Compile-time dependencies
Provides
Requires
Configuration requests
Configuration file options
Database prerequisites

Before using this driver, you need to have database created in your PostgreSQL server. You can create it using UNIX shell by typing such command:

createdb postlog

('postlog' is example database name; depending on database server policies, you may be asked for database user password after entering this; if you do not have database user account, ask database administrator to create one for you).

Then you can enter database shell by typing such command:

psql postlog

Now you can enter SQL commands. First you need to create incremental sequence that will be used as primary key ('postlog_seq' is example sequence name):

CREATE SEQUENCE postlog_seq START 1 INCREMENT 1 MINVALUE 1;

Then you have to create table for each subscribed (or provided) device. Although record structure for each table depends on interface type, first fields are common for each table:

id INT4 PRIMARY KEY, index INT2 NOT NULL, unixtime BIGINT NOT NULL, hdrtime DOUBLE PRECISION NOT NULL, globaltime DOUBLE PRECISION NOT NULL, subtype VARCHAR(50) NOT NULL

Additionally, you can add PostgreSQL date and time fields that will be filled automatically:

date DATE DEFAULT CURRENT_DATE NOT NULL, time TIME(4) DEFAULT CURRENT_TIME(4)

Time from four different sources (system clock, data header, Player global clock, SQL server clock) will give you whole image of this infrastructure time dependencies.

Currently supported interfaces are:

Example

driver
(
  name "postlog"
  tables ["table1" "table2"]
  requires ["table1::6665:position2d:0"]
  provides ["log:0" "table2:::position2d:10"]
  wait_for_all 1
  alwayson 1
)
driver
(
  name "cmdsplitter"
  provides ["position2d:0"]
  devices 2
  requires ["1::6665:position2d:0" "0:::position2d:10"]
)

This is not a threaded driver, it is good idea to keep it in separate Player instance.

Author:
Paul Osmialowski