How to see the latest x lines from systemctl service log
journalctl --unit=my.service -n 100 --no-pager
Just pipe the output to tail
:
journalctl --unit=my.service | tail -n 300
The tail
command prints the last lines (10 by default) received in stdin to stdout.
If you want to see the last n number of lines and see new messages as they are printed to the log, try this:
journalctl -u <service name> -n <number of lines> -f
Where -n
indicates the number of lines you'd like to see from the tail of the log, and -f
specifies that you'd like to follow the log as it changes.