Log Rotation and Deleting Old Logs

Plugins developed solely by Ardexa will write their data locally to the directory /opt/ardexa/logs. This data is captured to a file called latest.csv in various sub-directories. Ardexa plugins also keep a historical archive of all data, locally on the edge device, in files that are named by day with the format of YYYY-MM-DD.csv...eg 2023-03-26.csv. These files are kept on disk for the life of the system.

However, if disk space is running out on the edge device, the Ardexa Black Box plugin will delete the oldest data first. This only happens if the black box plugin detects that more than 75% of the disk has been used. It will then attempt to delete data from the logging area (/opt/ardexa/logs). If this area uses less than 5% of the disk, data will not be deleted. Only the oldest month/year will be deleted in a 5 minute run of the black box plugin. If data is deleted, the activity will be logged to the cloud.

Ardexa plugins provide their own log rotation. For other plugins that don't, the logrotate plugin (found in the MANAGEMENT plugins area) will optionally manage the rotation. To activate log rotation on a plugin's log files, simply create a file .rotate inside the target /opt/ardexa/logs directory, e.g. /opt/ardexa/logs/table/source/.rotate. The logrotate plugin uses the Linux logrotate application (https://linux.die.net/man/8/logrotate), to manage latest.csv rotations. We do stress; this plugin is not required for Ardexa plugins. It is (mostly) required for other plugins such as the the Clavis plugins, where log rotation is not handled. If in doubt, it does not hurt to install the logrotate plugin on a device.

Last updated