If you have to diagnose some configuration troubles, it may sometimes be interesting to persist the logs over reboot. This can be done by changing the location of the logs to the internal flash memory.
Logging to the flash memory will decrease the memory's lifespan. You should do this only temporary for diagnose purpose. The lifespan reduction will depend on the amount of logging.
If you change the logging destination to make it persistent, these logs will not be shown through the Manager web interface.
Persistent log files create with this method are automatically deleted when taking too much space (>500k)
The steps to change the location of a log file are:
- Create a new logging rules file
- Reload the rules
- Find your logs
Create a new logging rules file
You can easily create a new rule file by duplicating an existing one from /etc/syslog-ng/conf.d
.
For example, to persist LoRa forwarder logs, duplicate the /etc/syslog-ng/conf.d/applicative.conf file:
sudo cp /etc/syslog-ng/conf.d/applicative.conf /etc/syslog-ng/conf.d/applicative-persistent.conf
BASH
In the file, replace volatile-file by persistent-file:
sudo sed -i 's|volatile-file|persistent-file|g' /etc/syslog-ng/conf.d/applicative-persistent.conf
BASH
Reload the rules
Reload the rules with:
sudo rc-service syslog-ng reload
CODE
The new rules are now effective.
Find the logs
You will find the logs created by the new rules in /var/log-persistent
on the disk.
The persistent logs are NOT available in the Manager UI.