Remote Logging on Ubuntu Core

When using Ubuntu Core in appliance setups it is often helpful to have a centralized log server where all devices send their logs.

To set this up on Ubuntu Core you can easily install the logsync-james snap on the devices, then connect the necssary interfaces with:

snap connect logsync-james:daemon-notify
snap connect logsync-james:time-control
snap connect logsync-james:network-control
snap connect logsync-james:log-observe

Now install the logsync-receiver snap on the machine that should act as the centralized log server.

As last step set the url for the logsync-james snap on the devices with the following command:

snap set logsync-james url="http://<ip-of-the-machine-running-logsync-receiver>"

This will automatically start the central logging …

To read the logs on the server you can now use the following command:

sudo journalctl -D /var/snap/logsync-receiver/current/
1 Like

Hi @ogra ,

I am newbie to snaps and I need /var/log/syslog files from Ubuntu core 22 for my project hence I came across this post and trying to setup the remote logging. Currently, I am unable to view logs on receiver.

Details - I have setup the remote logging on my system Ubuntu core - 22 and receiver on another system which is Ubuntu desktop 22.

Logs - UC 22 -

shriyak@ubuntu:~$ sudo snap logs logsync-james.upload 2024-02-15T12:54:41Z systemd[1]: Stopping Service for snap application logsync-james.upload… 2024-02-15T12:54:41Z systemd[1]: snap.logsync-james.upload.service: Deactivated successfully. 2024-02-15T12:54:41Z systemd[1]: Stopped Service for snap application logsync-james.upload. 2024-02-15T12:54:41Z systemd[1]: snap.logsync-james.upload.service: Consumed 1.638s CPU time. 2024-02-15T12:54:41Z systemd[1]: Started Service for snap application logsync-james.upload. 2024-02-15T13:13:52Z systemd[1]: Stopping Service for snap application logsync-james.upload… 2024-02-15T13:13:52Z logsync-james.upload[4176]: Received SIGTERM from PID 1 (systemd). 2024-02-15T13:13:52Z systemd[1]: snap.logsync-james.upload.service: Deactivated successfully. 2024-02-15T13:13:52Z systemd[1]: Stopped Service for snap application logsync-james.upload. 2024-02-15T13:13:52Z systemd[1]: Started Service for snap application logsync-james.upload.

Receiver -

test@test-ThinkCentre-M92p:~$ sudo snap logs logsync-receiver.remote 2024-02-15T18:11:12+05:30 systemd[1]: Started Service for snap application logsync-receiver.remote. test@test-ThinkCentre-M92p:~$ sudo journalctl -f -D /var/snap/logsync-receiver/current/ No journal files were found.

Kindly provide your inputs.

Queries -

  1. Are there any way to get syslog for UC22 ?
  2. Does log-observe also captures syslog ?

Thank you.