I have an app registered as a service in Ubuntu 16.04
If I type:
journalctl -u myapp.service
I can see the logs for my app.
I am moving my app to a new VM where the same service will be in place. Is it possible to migrate the log files to the new VM so that if I type
journalctl -u myapp.service it will show all my old logs and any new logs seamlessly?
I have tried to swap in the contents of the old /var/log/journal directory into the new VM, and restarting the systemd-journald service, but it doesn't seem to work.
- The logs are stored in /var/log/journal/< machine-id >/
- the directory contents look like this:
$ ls /var/log/journal/05b6b1e76c6040cc99b4d34977a98eca/ [email protected]~ [email protected]~ [email protected]~ [email protected]~ email@example.com firstname.lastname@example.org email@example.com system.journal [email protected]~ [email protected]~ [email protected]~ [email protected]~ firstname.lastname@example.org user-1000.journal
- There are no files in /run/log/
- both old and new VMs share the same service, service-running user, and machine-id (this is because ultimately both VMs stem from (were copied from) the same VM just at different times and with minor software/configuration settings)
- the user I access the logs with 'ubuntu' has the same groups in both VMs:
ubuntu adm dialout cdrom floppy sudo audio dip video plugdev netdev lxd
- journal version on both VMs is:
$ journalctl --version
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN
- I am not looking to hold the logs longer than what is configured in the journal settings
- replacing the contents of the journal folder entirely
- adjusting file ownership to root:systemd-journal as they were originally
- 'root' can now see the full log
- 'ubuntu' can only see some 'current' logs, which are confusing, as they are not what was copied over