Syslog + Legato logread

Hello

I am activating SYSLOGD in order to manage my application logs, it has the advantages of rolling multiple log files etc…

I would like the Legato logs to be logged into SYSLOG, how can this be achieved?

if there is no “built in” method I would like to “pipe” the legato log file to syslogd, where is this file located?

thank you

1 Like

Hi,

If I understand it correctly, I think legato logs are stored in memory. You can only access them using the logread command.

A way to get them and pipe them into a file or a program, without having to manually start the command, would be to add a bash script into the /etc/init.d directory with something like :

logread -f | ... &

Feel free to correct me if I am wrong or if I misunderstood your question :slight_smile:

2 Likes

Great info thanks for sharing stuff by the way. :grinning:

@deadpoolcode, can we know if the issue is still current?

Hey sorry to dig again into that thread but I found something that could help with logs.
There is a file: /etc/syslog-startup.conf where you can update the config to change the log output.
For example if you want to log into /home/root/syslog.log you can update the file to have something like this :

# first line change from buffer to file
DESTINATION=file      # log destinations (buffer file remote)
# second line to telle where the file will be created
LOGFILE=/home/root/syslog.log   # where to log (file)
REMOTE=loghost:514      # where to log (syslog remote)
REDUCE=no               # reduce-size logging
DROPDUPLICATES=no       # whether to drop duplicate log entries
#ROTATESIZE=0           # rotate log if grown beyond X [kByte]
#ROTATEGENS=3           # keep X generations of rotated logs
BUFFERSIZE=2000         # size of circular buffer [kByte]
FOREGROUND=no           # run in foreground (don't use!)
#LOGLEVEL=5             # local log level (between 1 and 8)

Hope this can help

1 Like

To save the target from flash burnout, the syslog and core files are stored in the RAM file system under /tmp. When a crash occurs, this directory is created : /tmp/legato_logs/

To save RAM space, only the most recent 4 copies of each file are preserved. If the fault action for that app’s process is to reboot the target, the output location is changed to the below location (and the most recent files in RAM space are preserved across reboots):

/mnt/flash/legato_logs/

1 Like

how to write the application log into the text file instead of printing it in the terminal.

You can try system() call with “logread > /tmp/log.txt” inside an unsandboxed application