Search by Tags

Persistent Journald Logging

 

Article updated at 06 Feb 2020
Subscribe for this article updates

Introduction

Journald is a system service for collecting and storing log data, introduced with systemd. It tries to make it easier for system administrators to find interesting and relevant information among an ever-increasing amount of log messages.

To avoid excessive wear of the limited flash memory on Toradex modules, the journald data is stored in RAM only by default. To debug certain aspects such as unexpected reboots, it is handy to activate persistent journald logging, so the log messages of previous boot cycles can be reviewed.

Steps to Activate Persistent Logging

  1. Edit the file /etc/systemd/journald.conf
    Modify the line

    #Storage=auto
    

    to

    Storage=persistent
    
  2. Edit the file /etc/tmpfiles.d/00-create-volatile.conf
    delete the following line

    d               /var/volatile/log               1777    -       -
    
  3. Delete the symbolic link to the log folder

    # rm /var/log
    

That's it.

Testing the persistent logging

  1. reboot the module twice

    # reboot
    
  2. list all boot cycles, and display the detailed messages of the previous (not the current) boot cycle

    # journalctl --list-boots
    # journalctl -b -1