enter code here
I have a C++ application running on an Embedded Linux device which uses systemd.
If I wish to stream the debug output of my services / processes, I SSH into the device and execute command journalctl -u <my_systemd_service>.service -f
from the terminal, where <my_systemd_service>
is my actual service name.
Now the issue is that during production, I'd like to have SSH disabled for security reasons. However, I would still like to be retrieve the debug output sometimes, triggered by sending an MQTT command to the device as the device is connected to an MQTT broker.
Is there a way to get my debug output from within the C++ code itself when the MQTT command is received?
I don't suppose using system()
would be ideal. For example system("journalctl -u <my_systemd_service>.service -f")
? Of course this would also need to run in a separate thread if so. Any recommendations would be appreciated.