Daemon: simple how to see syslog for app snap?

if a app snap is run deamon, how to see the syslog of running app snap?

If the app is a service, you can either use snap logs <snap> or directly call journalctl like this: journalctl -u snap.<snap-name>.<svc-name>.service.

thanks reply. i use snap logs is useful to see the snap logs.And i want to know where these logs save in system file?

The logs are collected and stored by systemd-journald. You will need to consult the systemd documentation to find out the exact place where logs are stored. This should be a good starting point: https://www.freedesktop.org/software/systemd/man/journald.conf.html Usually it’s somewhere under /var/log/$(cat /etc/machine-id)/.

thanks reply. below is In the /var/log/ files


Your system may be configured to store logs in different location. Try inspecting journald.conf to find out the location.

I check the journald.conf file don’t find the syslog location.

journald defaults to logging to a tmpfs ringbuffer in /run/log/journal to make it log persistent you only need to create the dir /var/jog/journal and it will automatically start writing log files there instead.

/var/jog/journal is read only system files

not here …

ogra@localhost:~$ ls /var/log/
btmp  console-conf  lastlog  tallylog  wtmp
ogra@localhost:~$ sudo mkdir /var/log/journal
ogra@localhost:~$ sudo reboot
Connection to closed by remote host.
Connection to closed.
ogra@acheron:~$ ssh
Welcome to Ubuntu Core 18 (GNU/Linux 5.3.0-1019-raspi2 armv7l)
 * Ubuntu Core:     https://www.ubuntu.com/core
 * Community:       https://forum.snapcraft.io
 * Snaps:           https://snapcraft.io
Please see 'snap --help' for app installation and updates.
Last login: Mon Mar 23 10:27:12 2020 from
ogra@localhost:~$ ls -l /var/log/journal/
total 4
drwxr-sr-x+ 2 root systemd-journal 4096 Mar 19 16:51 6c7abda527af422aa97ff92950470ed2