3

Example [from Ubuntu 17.04]

The service is known as network-manager by systemd.

$ systemctl list-unit-files | grep network
network-manager.service                    enabled  

Looking for log information on that would give an impression that there are no entries.

$ sudo journalctl -u network-manager
-- No entries --
$ sudo journalctl -u network-manager.service
-- No entries --

Eventually I found out that it's:

$ sudo journalctl -u NetworkManager

Is there a consistent way to know under what name does a service goes in journald logs?

2 Answers 2

1

The confusion arises from having both NetworkManager and network-manager services on the system:

$ systemctl list-unit-files | grep NetworkManager
NetworkManager-dispatcher.service          enabled  
NetworkManager-wait-online.service         enabled  
NetworkManager.service                     enabled  
$ systemctl list-unit-files | grep network-manager
network-manager.service                    enabled 

and journalctl -u responding the same way for units without log entries and non existing units:

$ sudo journalctl -u network-manager
-- No entries --
$ sudo journalctl -u there-sure-isnt-a-service-named-like-this
-- No entries --

There is a simpler way of geting the log files beloning to a certain service and that is by using systemctl status.

$ sudo systemctl status network-manager.service 
● NetworkManager.service - Network Manager
   Loaded: loaded (/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2017-08-15 16:12:15 CEST; 2 days ago
     Docs: man:NetworkManager(8)
 Main PID: 12950 (NetworkManager)
    Tasks: 4 (limit: 4915)
   CGroup: /system.slice/NetworkManager.service
           ├─12950 /usr/sbin/NetworkManager --no-daemon
           └─13011 /sbin/dhclient -d -q -sf /usr/lib/NetworkManager/nm-dhcp-helper -pf /var/run/dhclient-wlp4s0.pid -lf /var/lib/NetworkManager/dhclient-c19d95a3-6082-4c89-ab

Aug 17 15:09:48 alan-N551JM NetworkManager[12950]: <info>  [1502975388.9172] device (wlp4s0): supplicant interface state: associating -> 4-way handshake
Aug 17 15:09:48 alan-N551JM NetworkManager[12950]: <info>  [1502975388.9386] device (wlp4s0): supplicant interface state: 4-way handshake -> completed
Aug 17 15:11:48 alan-N551JM NetworkManager[12950]: <info>  [1502975508.7640] device (wlp4s0): supplicant interface state: completed -> authenticating
Aug 17 15:11:48 alan-N551JM NetworkManager[12950]: <info>  [1502975508.7707] device (wlp4s0): supplicant interface state: authenticating -> associating
Aug 17 15:11:48 alan-N551JM NetworkManager[12950]: <info>  [1502975508.7876] device (wlp4s0): supplicant interface state: associating -> 4-way handshake
Aug 17 15:11:48 alan-N551JM NetworkManager[12950]: <info>  [1502975508.8064] device (wlp4s0): supplicant interface state: 4-way handshake -> completed

which gives you the auto complete option for service names and errors for non existing services:

$ sudo systemctl status there-sure-isnt-a-service-named-like-this
Unit there-sure-isnt-a-service-named-like-this.service could not be found.

Note: I'm sure there is a connection between NetworkManager and network-manager, however it isn't important for the answer.

0

The exact names from the services can be found in:

/etc/systemd/system/*
/usr/lib/systemd/system/*

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .