I have a service (written by myself) running on a Debian (Jessie) server, and the service's own logs happen to indicate that it restarted at a particular time. There is no indication of a segfault or other crash, so I am now trying to figure out if the application somehow silently failed and got respawned by systemd, or whether a user purposely restarted the service via systemctl
.
The shell history doesn't show such activity, but that is not conclusive because of export HISTCONTROL=ignoreboth
and because an SSH session might have just timed out, preventing a previous login's bash history from being written to disk. The server was not rebooted at the time.
But I would expect that systemd itself should keep a log indicating when a service was purposely restarted. To my surprise I was unable to find any documentation (e.g. for journalctl
) on how to get such logs.
Some other posts (e.g. Where is / why is there no log for normal user systemd services?) seem to indicate that there should be log messages like this:
Jan 15 19:28:08 qbd-x230-suse.site systemd[1]: Starting chatty.service...
Jan 15 19:28:08 qbd-x230-suse.site systemd[1]: Started chatty.service.
But I don't see such log messages on my system.
Is there a way to find out when systemd services were started, stopped or restarted?
Edit: It seems the typical problem people might run into is that they run journalctl
as a non-privileged user. This is not the case for me, I have been operating as root
the whole time. In response to a comment, running grep systemd /var/log/syslog
gives me only this:
Jun 6 09:28:35 server systemd[22057]: Starting Paths.
Jun 6 09:28:35 server systemd[22057]: Reached target Paths.
Jun 6 09:28:35 server systemd[22057]: Starting Timers.
Jun 6 09:28:35 server systemd[22057]: Reached target Timers.
Jun 6 09:28:35 server systemd[22057]: Starting Sockets.
Jun 6 09:28:35 server systemd[22057]: Reached target Sockets.
Jun 6 09:28:35 server systemd[22057]: Starting Basic System.
Jun 6 09:28:35 server systemd[22057]: Reached target Basic System.
Jun 6 09:28:35 server systemd[22057]: Starting Default.
Jun 6 09:28:35 server systemd[22057]: Reached target Default.
Jun 6 09:28:35 server systemd[22057]: Startup finished in 59ms.
Jun 6 09:37:08 server systemd[1]: Reexecuting.
grep systemd /var/log/syslog
– hschou Jun 02 '17 at 10:20Stopped target Default
,Starting Shutdown
etc. Nothing indicating anything about individual services. Maybe it's just a configuration problem? Note I am on Debian Jessie in this particular case. – mindriot Jun 02 '17 at 10:57/etc/systemd/journald.conf
hasn't overriddenMaxLevelStore
orMaxLevelSyslog
, and look in all the other places you can configure journald as listed inman journald.conf
. – meuh Jun 10 '17 at 16:12/etc/systemd
are essentially empty (all options commented out, including the ones you mentioned). – mindriot Jun 12 '17 at 16:47