Find a service file

1
le service | v
1
v /etc/systemd/system/multi-user.target.wants/ssh.service

It’s aliased to:

1
v /etc/systemd/system/sshd.service

nvi

1
v /etc/systemd/system/multi-user.target.wants/nvi.service
1
journalctl -u nvi
-- Logs begin at Thu 2019-12-12 21:51:53 NZDT, end at Fri 2019-12-13 18:25:01 NZDT. --
Dec 12 21:51:54 morgan systemd[1]: Starting Recover nvi edit sessions....
Dec 12 21:51:54 morgan recover[1085]: Recovering nvi editor sessions.
Dec 12 21:51:54 morgan recover[1085]: rm: cannot remove '/var/tmp/vi.recover/vi.AJhu91': Is a directory
Dec 12 21:51:54 morgan recover[1085]: rm: cannot remove '/var/tmp/vi.recover/vi.D28Jfm': Is a directory
Dec 12 21:51:54 morgan recover[1085]: rm: cannot remove '/var/tmp/vi.recover/vi.LWx7mV': Is a directory
Dec 12 21:51:54 morgan recover[1085]: rm: cannot remove '/var/tmp/vi.recover/vi.yKckdB': Is a directory
Dec 12 21:51:55 morgan su[1214]: Successful su for nobody by root
Dec 12 21:51:55 morgan su[1439]: Successful su for nobody by root
Dec 12 21:51:55 morgan su[1230]: Successful su for nobody by root
Dec 12 21:51:55 morgan su[1439]: + ??? root:nobody
Dec 12 21:51:55 morgan su[1214]: + ??? root:nobody
Dec 12 21:51:55 morgan su[1230]: + ??? root:nobody
Dec 12 21:51:55 morgan su[1439]: pam_unix(su:session): session opened for user nobody by (uid=0)
Dec 12 21:51:55 morgan recover[1085]: done.
Dec 12 21:51:55 morgan systemd[1]: Started Recover nvi edit sessions..

Given a service file such as this

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
[Unit]
Description=OpenBSD Secure Shell server
After=network.target auditd.service
ConditionPathExists=!/etc/ssh/sshd_not_to_be_run

[Service]
EnvironmentFile=-/etc/default/ssh
ExecStartPre=/usr/sbin/sshd -t
ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
ExecReload=/usr/sbin/sshd -t
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255
Type=notify

[Install]
WantedBy=multi-user.target
Alias=sshd.service

The name of the service

1
v /etc/init.d/ssh

This will get the logs you require

1
journalctl -u ssh
-- Logs begin at Thu 2019-12-12 21:51:53 NZDT, end at Fri 2019-12-13 18:26:30 NZDT. --
Dec 12 21:51:55 morgan systemd[1]: Starting OpenBSD Secure Shell server...
Dec 12 21:51:55 morgan sshd[1835]: Server listening on 0.0.0.0 port 22.
Dec 12 21:51:55 morgan sshd[1835]: Server listening on :: port 22.
Dec 12 21:51:55 morgan systemd[1]: Started OpenBSD Secure Shell server.
Dec 12 21:52:05 morgan systemd[1]: Reloading OpenBSD Secure Shell server.
Dec 12 21:52:05 morgan sshd[1835]: Received SIGHUP; restarting.
Dec 12 21:52:05 morgan systemd[1]: Reloaded OpenBSD Secure Shell server.
Dec 12 21:52:05 morgan sshd[1835]: Server listening on 0.0.0.0 port 22.
Dec 12 21:52:05 morgan sshd[1835]: Server listening on :: port 22.
Dec 12 21:52:05 morgan systemd[1]: Reloading OpenBSD Secure Shell server.
Dec 12 21:52:05 morgan systemd[1]: Reloaded OpenBSD Secure Shell server.
Dec 12 21:52:05 morgan sshd[1835]: Received SIGHUP; restarting.
Dec 12 21:52:05 morgan sshd[1835]: Server listening on 0.0.0.0 port 22.
Dec 12 21:52:05 morgan sshd[1835]: Server listening on :: port 22.
Dec 12 21:52:24 morgan systemd[1]: Reloading OpenBSD Secure Shell server.
Dec 12 21:52:24 morgan sshd[1835]: Received SIGHUP; restarting.
Dec 12 21:52:24 morgan systemd[1]: Reloaded OpenBSD Secure Shell server.
Dec 12 21:52:24 morgan sshd[1835]: Server listening on 0.0.0.0 port 22.
Dec 12 21:52:24 morgan sshd[1835]: Server listening on :: port 22.
Dec 12 21:52:24 morgan systemd[1]: Reloading OpenBSD Secure Shell server.
Dec 12 21:52:24 morgan sshd[1835]: Received SIGHUP; restarting.
Dec 12 21:52:24 morgan systemd[1]: Reloaded OpenBSD Secure Shell server.
Dec 12 21:52:24 morgan sshd[1835]: Server listening on 0.0.0.0 port 22.
Dec 12 21:52:24 morgan sshd[1835]: Server listening on :: port 22.
Dec 13 11:17:04 morgan systemd[1]: Stopping OpenBSD Secure Shell server...
Dec 13 11:17:04 morgan systemd[1]: Stopped OpenBSD Secure Shell server.

But why does this not show logs?

1
journalctl -u sshd
-- No entries --