毎度のように調べているので。楽にコピペできるように自分用メモ。
# Switch to root user
sudo su -
# Show user-data file
cat /var/lib/cloud/instance/user-data.txt
# Show cloud-init log
cat /var/log/cloud-init-output.log
# Show service file
systemctl cat my-awesome.service
# Show service status
systemctl status my-awesome.service
# Show the last 100 lines of the journal for the service (current boot)
journalctl -u my-awesome.service -b --no-pager -n 100
# Show the first 100 lines of the journal for the service (current boot)
journalctl -u my-awesome.service -b --reverse | tail --no-pager -n 100
# Show the journal for the service between specific times (current boot)
journalctl -u my-awesome.service -b --since "2026-01-01 09:00:00" --until "2026-01-01 12:00:00"
# Follow service log in real-time
journalctl -u my-awesome.service -f