Data Logging Service Configuration
The LucidIoT network I/O module is able to transmit I/O values via MQTT, Modbus TCP/IP or the JSON protocol.
The data logging service can also write I/O values and system values to the file system. If data logging and at least one log value entry are enabled, recording starts with configurable interval.
The data logging service can be helpful when LucidIoT is used without network connection.
The picture shows the configuration web page of data logging function.
The Log Interval specifies the time between two log events. The interval is configured in 1/10 s (10 -> 1 s interval). A log event generates a new data row.
The Separator defines the character dividing columns inside a data row.
The State provides information about the operation condition of the data logging service and the module state.
Clicking the Save button updates the settings.
Data Logging Value Configuration
The I/O logging function periodically logs up to 16 configurable values (Value 0 – 15).
If a value is enabled, it is processed.
A Name gives a descriptive name which is added to the header row of the log file.
Value Id links the log value with the I/O channel value.
The Format setting configures how values are represented in the log file. It specifies e.g. the precision of a logged value.
Data Logfiles
The data logging service creates one data log file per day. When the system date changes, the current data log file is closed and a new file is created becoming the active data log file.
The function creates sub-folders for each year and month. A data log file has the filename pattern YYYYMMDD.log. it is stored in the folder /log/YYYY/MM/.
In these cases, the function writes the header row to the data log file:
- A new data log file is created.
- On a system restart when an existing data log file is opened
- Change of data logging value configuration
A data row starts with a time stamp column followed by the enabled log values.
The service uses the local time zone and formats the time stamp in the format YYYY-MM-DD HH:MM:SS using 24 hours format.
Data log files with semicolon separation character are stored in CSV format which is compatible with most spreadsheet applications.
Example of a data log file
File location: /log/2021/01/20210101.log
Time;DigitalInSwitch;RoomTemp
2021-01-01 00:00:00;0;20.0
2021-01-01 00:00:01;0;20.1
2021-01-01 00:00:02;0;20.0
2021-01-01 00:00:03;1;19.9
2021-01-01 00:00:04;1;20.0
The file starts with the header row. It contains the mandatory time stamp and the names of two active log values DigitalInSwitch and RoomTemp separated by a semicolon separation character.
The subsequent data log rows consist of the time stamp (one log event per second) and the data log values.