---
marp: true
theme: uncover # gaia, uncover, default
header: "__ROS 2 logging rsyslog / FluentBit__"
footer: "[fujitatomoya@github](https://github.com/fujitatomoya)"
_backgroundColor: white
page_number: true
---
# ROS 2 Logging Subsystem
- ROS 2 provides a flexible and configurable logging subsystem.
- Supports multiple logging backends.
- `stdout`: Logs are printed to the standard output (default ON to console).
- `rosout`: Logs are published to the `/rosout` topic. (default ON)
- **external**: default [spdlog](https://github.com/gabime/spdlog), or your own implementation. :rocket:**TODAY's TOPIC**:rocket:
---
## Enabling and Disabling Logging Backends
- Node option in the program. (e.g `rclcpp::NodeOptions`)
- Global ROS arguments via CLI. (can be overridden by `NodeOptions`)
```bash
# Disabling rosout log publisher
ros2 run foo_pkg bar_exec --ros-args --disable-rosout-logs
# Disabling console output
ros2 run foo_pkg bar_exec --ros-args --disable-stdout-logs
# Disable any external loggers
ros2 run foo_pkg bar_exec --ros-args --disable-external-lib-logs
```
---
# Logging Severity Level
- `DEBUG`, `INFO`, `WARN`, `ERROR` and `FATAL`.
- A logger will only process log messages with severity at or higher than a specified level chosen for the logger.
- Logger names represent a hierarchy.
- If the level of a logger named `abc.def` is unset, it will defer to the level of its parent named `abc`, and if that level is also unset, the global default logger level will be used. When the level of logger `abc` is changed, all of its descendants (e.g. `abc.def`, `abc.ghi.jkl`) will have their level impacted unless their level has been explicitly set.
---
# For more information about ROS 2 logging...
- [logging level configuration service (default OFF)](https://docs.ros.org/en/rolling/Tutorials/Demos/Logging-and-logger-configuration.html#logger-level-configuration-externally)
- [logging level configuration via CLI](https://docs.ros.org/en/rolling/Tutorials/Demos/Logging-and-logger-configuration.html#logger-level-configuration-command-line)
- Console [output format](https://docs.ros.org/en/rolling/Tutorials/Demos/Logging-and-logger-configuration.html#console-output-formatting) and [output colorizing](https://docs.ros.org/en/rolling/Tutorials/Demos/Logging-and-logger-configuration.html#console-output-colorizing)
- [Setting the log file name prefix](https://docs.ros.org/en/rolling/Tutorials/Demos/Logging-and-logger-configuration.html#setting-the-log-file-name-prefix)
- [logging environmental variables](https://docs.ros.org/en/rolling/Concepts/Intermediate/About-Logging.html#environment-variables)
---
# [rcl_logging_syslog](https://github.com/fujitatomoya/rcl_logging_syslog)

- ROS 2 rcl logging implementation built on top of [syslog(3)](https://man7.org/linux/man-pages/man3/syslog.3.html).
- Connects with [rsyslog](https://www.rsyslog.com/) and [FluentBit](https://fluentbit.io/) / etc...
---



---
# Objectives
- Configure log behavior without code change.
- Multiple sink with different logging level filtering.
- Reasonable Performance.
- Log data pipeline and forward capability support.
- Enabling ROS 2 logging system with Cloud-Native Log Management and Observability.
---

---
# [Demo FluentBit](https://github.com/user-attachments/assets/bdb05bf7-92b2-4b9a-8f20-3d3b803a7a86)