Christoph Polcin

dlgr - Datalogger For Time Series Data

Datalogger aka dlgr is a simple command-line ap­pli­ca­tion. It logs one floating point value per time. The ap­pli­ca­tion is written in C and uses a SQLite database.

Multiple trackers keeping various time value relations. It also provides an option to execute user-defined SQLite queries to filter, export or process your logs.

Use Datalogger to log tem­per­a­tures, stock prices, fuel cost, daily power meter values or working hours.

Howto Install Datalogger

git clone http://git.christoph-polcin.com/c/dlgr
make
make install
mkdir -p ~/.config/dlgr
dlgr --help

A Few Examples

# create tracker
dlgr fuel -c

# list all trackers
dlgr -l

# log values
dlgr fuel -t 0 -v 1.50
dlgr fuel -t -5 -v 1.45
dlgr fuel -t 2010.04.12 -v 1.38
dlgr fuel -t 2010.04.15 -v 1.39
dlgr fuel -t 2010.05.15 -v 1.40

# list values
dlgr fuel -l
dlgr fuel -l -t 2010.04..2010.05

# execute a user-defined query
dlgr fuel -q "SELECT MIN(v),t,OID FROM fuel"
dlgr fuel -q "SELECT MAX(v),t,OID FROM fuel"

# import data from a CSV file
dlgr fuel -i 2010.csv

# export a range of values
dlgr fuel -e -t 2010.04..2010.05 > fuel-201004-201005.csv

Usage

Usage: dlgr [TRACKER] [OPTIONS]

OPTIONS
    -c, --create           Create a new tracker
    -d, --database <FILE>  SQLite3 database file
    -e, --export           Export as CSV (oid,value,timestamp)
    -i, --import <FILE>    Import a file with CSV (value,DATE)
    -l, --list             List trackers or tracker logs
    -q, --query <QUERY>    Execute a user-defined SQLite query
                             columns: time->t, value->v, id->OID
    -r, --remove <OID>     Remove a log
    -t, --time <DATE>      Date
                             +/-N - N Days ahead/ago
                             0 - Today 00:00:00
                             dd[.mm[.yyyy [HH[:mm[:ss]]]]]
                             yyyy[.mm[.dd [HH[:mm[:ss]]]]]
                             UNIX Timestamp
                             DATE..DATE to get a time span
    -v, --value <FLOAT>    Value to log
    -h, --help             For general usage information

For bigger data consider RRDtool. Sug­ges­tions and patches are welcome.