C++ CMake Syslog Dashboard
This guide walks you through building and running the C++ CMake syslog dashboard reference on Avocado OS. The app reads the systemd journal and renders a live TUI with message rates, severity breakdowns, and top logging units.
Prerequisites
- macOS 10.12+ or Linux (Ubuntu 22.04+, Fedora 39+)
- Docker Desktop installed and running
- The latest version of the Avocado CLI
For hardware targets, you will also need:
- Your target device and any required accessories (SD card, USB cable, serial console adapter)
- See the Support Matrix for your target's requirements
Initialize
Clone the reference or initialize a new project from it:
avocado init --reference cpp-tui-dashboard cpp-tui-dashboard
cd cpp-tui-dashboard
To target specific hardware instead of the default, pass --target:
avocado init --reference cpp-tui-dashboard --target raspberrypi5 cpp-tui-dashboard
cd cpp-tui-dashboard
Install
Install the SDK toolchain, extension dependencies, and runtime packages:
avocado install -f
This pulls the SDK container image and installs the cross-compilation toolchain along with nativesdk-cmake.
Build
Build the extensions and assemble the runtime image:
avocado build
The build step runs app-compile.sh inside the SDK container, which generates a CMake toolchain file from the SDK environment, fetches FTXUI via FetchContent, and cross-compiles the dashboard binary. Then app-install.sh copies the binary into the extension sysroot at /usr/bin/syslog-dashboard.
Deploy
QEMU
For QEMU targets, provision and boot the VM:
avocado provision -r dev
avocado sdk run -iE vm dev
SD card targets (Raspberry Pi, Seeed reTerminal, NXP, STMicroelectronics)
Insert your SD card and provision:
avocado provision -r dev --profile sd
Insert the SD card into the device and apply power.
USB flash targets (OnLogic)
avocado provision -r dev --profile usb
NVIDIA Jetson
avocado provision -r dev --profile tegraflash
Follow the USB disconnect/reconnect prompts during the flash process.
Verify
Log in as root with an empty password. The app service starts automatically on boot. When running as a service (no TTY), it logs periodic summaries to the journal.
Check the service is running:
systemctl status app
Watch the headless output:
journalctl -u app -f
You should see output like:
syslog-dashboard: 142 total | 8 msg/s | ERR:2 WARN:15 INFO:125
Interactive TUI
For the full terminal dashboard, SSH into the device and run it directly:
syslog-dashboard
You will see a live dashboard with:
- A message rate sparkline (60-second window)
- Severity counters (EMERG through DEBUG, color-coded)
- Top logging units ranked by message count
- A scrolling list of recent journal entries
Press q to quit.
Customize
Change the journal filter
Edit app/src/main.cpp and modify the journalctl command in the journal_reader function to filter by unit, priority, or time range:
// Only show errors and above
FILE* pipe = popen("journalctl -f -o export --no-pager -p err 2>/dev/null", "r");
// Only show a specific unit
FILE* pipe = popen("journalctl -f -o export --no-pager -u myapp.service 2>/dev/null", "r");
Adjust the UI refresh rate
The UI refreshes every 500ms by default. Change the interval in the run_tui function:
std::this_thread::sleep_for(std::chrono::milliseconds(250)); // faster refresh
Rebuild after changes
After any change, rebuild and reprovision:
avocado build
avocado provision -r dev