Skip to content

Repository files navigation

Datalogger

A flexible data logging tool for collecting metrics from various sources (Modbus, HTTP) and writing to multiple outputs (InfluxDB, MQTT, CSV).

Configuration

Configuration is done via YAML file (passed with -config flag). See examples/example_config for a complete reference.

Input types:

  • Modbus: TCP/RTU with range or direct register access
  • HTTP: JSON responses with gjson path syntax for value extraction

Output types: InfluxDB 3.x, MQTT, CSV

InfluxDB 3.x Schema Design

Schema Structure

Element Type Description Example
Measurement Table name Device name spine
Tag: point Metadata Identifies the measurement point a_voltage, temperature
Tag: unit Metadata Unit of measurement (optional) V, C, %
Field: value Measured data The actual reading value 230.5, 45.2
Timestamp Time When the reading was taken Unix nanoseconds

Line Protocol format:

spine,point=a_voltage,unit=V value=230.5 1712345678901234567

InfluxDB 3.x Query Examples

Basic time series query for a single point:

SELECT time AS "Time", value AS "A Phase Voltage"
FROM spine
WHERE point = 'a_voltage'

With Grafana time range filter (FlightSQL):

SELECT time AS "Time", value AS "C Phase Voltage"
FROM spine
WHERE point = 'c_voltage' AND time >= $__timeFrom() AND time <= $__timeTo()

Multiple points in one query:

SELECT time AS "Time", value AS "Voltage"
FROM spine
WHERE point IN ('a_voltage', 'b_voltage', 'c_voltage')
  AND time >= $__timeFrom() AND time <= $__timeTo()

Query all points from a device:

SELECT time AS "Time", point, value
FROM spine
WHERE time >= $__timeFrom() AND time <= $__timeTo()

Query with unit filter:

SELECT time AS "Time", point, value, unit
FROM spine
WHERE unit = 'V' AND time >= $__timeFrom() AND time <= $__timeTo()

Aggregate by point (average voltage):

SELECT point, AVG(value) AS "Average Value"
FROM spine
WHERE point LIKE '%voltage%' AND time >= $__timeFrom() AND time <= $__timeTo()
GROUP BY point

Latest value for each point:

SELECT point, value AS "Latest Value", time AS "Time"
FROM spine
WHERE time >= $__timeFrom() AND time <= $__timeTo()
GROUP BY point
ORDER BY time DESC
LIMIT 10

About

A flexible data logging tool for collecting metrics from various sources (Modbus, HTTP) and writing to multiple outputs (InfluxDB, MQTT, CSV).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages