# Log Manager

This package contains code for the Device.Syslog. object.

This package support 2 backend, namely, fluent-bit and syslog-ng. The logmngr package
abstracts the config and data model implemenation of the backend. The backend package
can be selected at compilation time by setting the corresponding config option.

The config option LOGMNGR_BACKEND_FLUENTBIT selects fluent-bit as the backend and is
the current iowrt default. The other config option present is LOGMNGR_BACKEND_SYSLOG_NG
which selects syslog-ng as the backend and can be alternatively selected.

## Design

The package is built as bbfdm dm-service (dotso) plugins, each compiled into its own
shared library from `src/`:

- `libbbfsyslog.so` (`src/syslog.c`) implements the `Device.Syslog.` tree: `Filter`,
  `Source`, `Template` and `Action` (with its `LogFile` and `LogRemote` children). It
  reads/writes the `logmngr` UCI config and, depending on the selected backend,
  generates the runtime configuration consumed by fluent-bit or syslog-ng.
- `libbbflogrotate.so` (`src/deviceinfologrotate.c`) implements
  `Device.DeviceInfo.LogRotate.{i}.`, the log-rotation policy for a given log file,
  also backed by the `logmngr` UCI config (`log_rotate` sections).
- `libbbfvendorlog.so` (`src/deviceinfovendorlog.c`) implements
  `Device.DeviceInfo.VendorLogFile.{i}.`, exposing vendor/rotated log files tracked
  internally via bbfdm's dmmap bookkeeping (not part of the `logmngr` UCI config).

All UCI section/option reads and writes go through the standard bbfdm `dmuci_*`
helpers, so the same source builds against either backend; only the generated
runtime config differs.

The UCI schema definition (sections, options, types, defaults, and their map to the
data model) is available at:
- [docs/uci/logmngr.json](docs/uci/logmngr.json) — machine-readable schema
- [docs/uci/logmngr.md](docs/uci/logmngr.md) — rendered reference table
