How do i display service related logs using systemd journalctl?



  • Man page for journalctl.

           -u, --unit=UNIT|PATTERN
               Show messages for the specified systemd unit UNIT (such as a
               service unit), or for any of the units matched by PATTERN. If a
               pattern is specified, a list of unit names found in the journal is
               compared with the specified pattern and all that match are used.
               For each unit name, a match is added for messages from the unit
               ("_SYSTEMD_UNIT=UNIT"), along with additional matches for messages
               from systemd and messages about coredumps for the specified unit.
    
               This parameter can be specified multiple times.
    
    $ journalctl -u training.service
    -- Logs begin at Thu 2019-01-31 19:40:25 GMT, end at Sat 2019-02-02 22:10:23 GMT
    Feb 02 15:00:13 centos-linux.shared systemd[1]: Started /bin/vmstat 2.
    Feb 02 15:00:13 centos-linux.shared vmstat[6491]: procs -----------memory-------
    Feb 02 15:00:13 centos-linux.shared vmstat[6491]: r  b   swpd   free   buff  cac
    Feb 02 15:00:13 centos-linux.shared vmstat[6491]: 2  0   1792 257688      0 8266
    Feb 02 15:00:15 centos-linux.shared vmstat[6491]: 0  0   1792 257820      0 8266
    ...
    ...
    ...
    

 

© Lightnetics 2019