You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by Petro Karashchenko <pe...@gmail.com> on 2022/01/13 17:56:21 UTC

Redirect syslog to file

Hi,

Is it possible to redirect syslog into a file (maybe even have it both on
UART and a file)? Also a question is there utility like logrotate or any
other so that maximum size for logs can be set and possibly compression
when one log file is closed and new one is open?

Best regards,
Petro

Re: Redirect syslog to file

Posted by Fotis Panagiotopoulos <f....@gmail.com>.
Hello,

Yes, all these exist.

You need to set:
SYSLOG_FILE=y

and then you may attach a file to the logger using:
syslog_file_channel()

If you want to also keep the UART logger active, then also set:
SYSLOG_MAX_CHANNELS=2
SYSLOG_DEFAULT=y

To have automatic rotations of the log files, you may use:
SYSLOG_FILE_ROTATIONS
SYSLOG_FILE_SIZE_LIMIT

In general, have a look in syslog's configurations, there are lots of
interesting options there.
Everything is located in: Device Drivers → System Logging


Στις Πέμ 13 Ιαν 2022 στις 7:56 μ.μ., ο/η Petro Karashchenko <
petro.karashchenko@gmail.com> έγραψε:

> Hi,
>
> Is it possible to redirect syslog into a file (maybe even have it both on
> UART and a file)? Also a question is there utility like logrotate or any
> other so that maximum size for logs can be set and possibly compression
> when one log file is closed and new one is open?
>
> Best regards,
> Petro
>