How to use journalctl command to see the logs of running services in linux machine

To check the full logs of service

Lets check the logs of tomcat9 which is currently running as systemd service in my linux machine.

You can check the logs for any systemd services like jenkins, sshd, docker, httpd, nginx …

sudo journalctl --unit tomcat9 

We can also use -u instead of --unit

This will print the full logs of the tomcat9 from the time it got installed.

journalctl

To check the today/yesterday logs of service

Lets check the todays log generated by tomcat9 service

sudo journalctl --unit tomcat9 --since today

journalctl

Lets check the yesterdays log generated by tomcat9 service

sudo journalctl --unit tomcat9 --since yesterday

journalctl

To check the logs from specific date and time

Lets check the logs of tomcat9 service from 2021-07-20 09:30:00

sudo journalctl --unit tomcat9 --since "2021-07-20 09:30:00"

journalctl

To check the logs from specific date to specific date and time

Lets check the logs of tomcat9 service from “2021-07-20 09:30” to “2021-07-22 10:00”

sudo journalctl --unit tomcat9 --since "2021-07-20 09:30" --until "2021-07-22 10:00"

journalctl

Reference

Journalctl guide from Digitalocean