Agent as System Daemon
To access and retrieve the Agent logs, first, ensure you have shell access to the device running the Agent. If you need remote access, you can use the Agent Shell component, provided it is configured and enabled. Follow these instructions to activate the Shell component if needed.
1. Confirm Systemd Service
Check and confirm if the Agent is Running as a Systemd Service.
systemctl status rocos-agent
2. Retrieve Logs Using Journalctl
To see the agent logs use journalctl command:
sudo journalctl -u rocos-agent.service
If you are looking for the agent logs for a certain period of time, you can use --since
or/and --until
flags to specify logs' period. For example:
sudo journalctl -u rocos-agent.service --since "24 hours ago" --until "10 hours ago"
Please check journalctl documentation for more precise filtering options.
3. Save Logs to a File
To save the logs to a file (e.g., agent_logs.txt), redirect the output:
sudo journalctl -u rocos-agent.service > agent_logs.txt
To Save Only the Last 24 Hours of Logs:
sudo journalctl -u rocos-agent.service --since "24 hours ago" > agent_logs_24h.txt
4. To Save Real-Time Logs
If you need to save real-time logs to a file, use tee to write to both the console and a file:
sudo journalctl -u rocos-agent.service -f | tee agent_realtime_logs.txt
5. Zip and Download Logs
To zip and download the logs, you can use the following command:
zip agent_realtime_logs.zip agent_realtime_logs.txt
Then you can use the file tab to find the file and download it. Check these instructions if you need to activate the file component.