Reputation: 705
We have recently moved to systemd, and it has been quite useful. But I cannot find a way to log the starts and restarts of a given service.
I can use journalctl SYSLOG_IDENTIFIER=systemd -u some-service.service
to see the entries, but there doesn't seem to be a way to log it when it happens.
I know that I could hook into the ExecStartPre=
or ExecStartPost=
directives, but we have a lot of services. I'm hoping for a more general solution.
Upvotes: 2
Views: 272
Reputation: 24
The only method that I've for logging systemd operations for each service involves embedding "systemd-notify" calls inside your application. Whether this can be used to create an application history/journal of start, stop, exit operations is still TBD. Am currently working on a project to try this method. Gotta love systemd ;)
Upvotes: 0