Persisting logs to SD card for debugging

Hello all,

I know Legato has some built in logging systems in terms of dumping logs to /mnt/flash/legato_logs on critical failure, however I’m looking to capture all logs at this moment.

I wrote a simple app that invokes logread and captures the stream, but I’m looking to build/configure something a little more robust (with log rotation). I also had a look at /etc/syslog-startup.conf but changing these settings didn’t seem to make a difference.

How have others been solving this problem? Is recording the output of logread and manually performing rotations my best bet, or is there an existing solution that works well?

Cheers!

Hi nvd,

Please find the workaround steps below for taking continous logging and store it in the sdcard, that will append the logs in every boot.

1)We need to add the below script in the /etc/init.d

#!/bin/sh

echo “running the script”

if test -e “/home/root/sd_card”
then
umount /dev/mmcblk0p1
rmdir /home/root/sd_card
fi

mkdir /home/root/sd_card

mount /dev/mmcblk0p1 /home/root/sd_card
logread >> /home/root/sd_card/log.txt

Note: Please check the dev in your system before mounting.

2)Call the script from the startlegato.sh, which is in the init.d
so whenever it reboots the script will keep called.

Please inform me, if this workaround is not helped to you. And also please free to ask about other queries related to this issue.