Viewing Logs for a systemd Unit with journalctl

When running systemd, the journal stores all the logs that are associated with the various services running under it.

This means that if you want to have a quick look through you'll likely have a lot of noise for other services, which may make it harder to find what you're looking for. If you know the unit you're looking to get the logs for, i.e. micropub.service, you can run the following:

$ journalctl -u micropub.service
-- Logs begin at Sat 2019-09-21 17:18:35 CEST, end at Sun 2019-09-22 10:46:25 CEST. --
Sep 21 18:24:43 www-api java[5513]: 2019-09-21 18:24:43.593  WARN 5513 --- [nio-8080-exec-1] o.s.web.servlet.PageNotFound             : Request method 'GET' not supported
Sep 22 08:21:51 www-api java[5513]: 2019-09-22 08:21:51.063 ERROR 5513 --- [nio-8080-exec-3] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception
Sep 22 08:21:51 www-api java[5513]: java.lang.IllegalArgumentException: Error when fetching token endpoint (unauthorized): The token provided was malformed
Sep 22 08:21:51 www-api java[5513]:         at ~[classes!/:na]

Written by Jamie Tanna's profile image Jamie Tanna on , and last updated on .

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under the Apache License 2.0.

#blogumentation #systemd.

This post was filed under articles.

Interactions with this post

Interactions with this post

Below you can find the interactions that this page has had using WebMention.

Have you written a response to this post? Let me know the URL:

Do you not have a website set up with WebMention capabilities? You can use Comment Parade.