Torizon: Possible solutions for logging

I am exploring what the best solution is for the following case:

  • Using Torizon
  • 2-3 containers with application in C++ or C# written
  • System logs should be included
  • Logs should be easily displayed, e.g. in ASP.NET | Open-source web framework for .NET App or on the host computer (sent via network).

While there are plenty of logging frameworks like NLog, log4cxx, log4net, etc. it’s not so simple for the system logs. It would make sense to use systemd-journal for all applications but I don’t found any good solution to display the logs to the end user.

Any suggestions or ideas?

Greetings @Qubit,

If I understand you correctly are you trying to find ways to get access to journald logs inside a container? Or are you just wondering how best to format the logs? It’s not quite clear what you mean by “logs should be easily displayed”.

That said I do have some ideas. For accessing systemd-journal logs inside a container you can do the following:

  • Bind-mount /run/log/journal inside your container
  • In the container install systemd
  • From here you can use the journalctl cli command to access the host system logs, from withing this container.

As for processing the logs and sending them off the device (to another host computer). You can make use of "fluent-bit`. On TorizonCore we have fluent-bit installed by default: Device Monitoring in TorizonCore | Toradex Developer Center

It’s mostly used for device-monitoring services related to our platform, but there’s no reason you can’t use it for your own purposes. On a quick search it seems fluent-bit has a plugin that takes systemd logs as an input: Systemd - Fluent Bit: Official Manual

You can then use fluent-bit to process/filter these logs then output them either locally or over network if that’s what you want.

These are just some ideas I had, but I’m sure there’s more out there.

Best Regards,

Hi @jeremias.tx

I’m brainstorming what the best (existing) solution is to collect system and application logs and display them easily for us and the end user without using the console.

I thought the display could be done in a separate container using ASP.NET | Open-source web framework for .NET application. Alternatively, send to a computer on the local network.

I didn’t know Fluent Bit so far. I think you already answered everything and showed a very nice solution! I will have a look at it in detail. Thank you very much!

Glad I was able to help provide some options!