List journal of systemd service using journalctl ?
- User
List journal of systemd service using journalctl ?
- Assistant
To list journal entries for a specific systemd service using
journalctl, you can use the following command:journalctl -u <service-name>Replace
<service-name>with the name of the service you are interested in. For example, to check the logs for a service namednginx.service, you would run:journalctl -u nginx.serviceHere are a few additional options you might find useful:
-
To view logs in real-time, use the
-foption (similar totail -f):journalctl -u <service-name> -f -
To show logs from the current boot only, use the
--bootoption:journalctl -u <service-name> --boot -
To show logs within a specific time range, you can use the
--sinceand--untiloptions:journalctl -u <service-name> --since "2023-10-01" --until "2023-10-02" -
To display logs in reverse order (most recent first), use the
-roption:journalctl -u <service-name> -r
Make sure to run these commands with enough privileges (you might need to use
sudodepending on your system's configuration). -