Is there a canonical way to get all the logs from journalctl since a service was last restarted? What I want to do is restart a service and immediately see all the logs since I initiated the restart.
I came up with:
$ unit=prometheus
$ sudo systemctl restart $unit
$ since=$(systemctl show $unit | grep StateChangeTimestamp= | awk -F= '{print $2}')
$ sudo systemctl status -n0 $unit && sudo journalctl -f -u $unit -S "$since"
This will probably work, but I was wondering if there is a more concrete way to say: restart and give me all logs from that point onwards.