1. 自动换行查看完整日志

    通过 --no-pager 选项可以看到自动换行的日志:

    [[email protected]]# journalctl -xu docker --no-pager
    ... ...
    Jun 14 15:14:47 localhost dockerd[7333]: time="2019-06-14T15:14:47.817433009+08:00" level=info msg="Docker daemon" commit=481bc77 graphdriver(s)=overlay2 version=18.09.6
    Jun 14 15:14:47 localhost dockerd[7333]: time="2019-06-14T15:14:47.818693748+08:00" level=info msg="Daemon has completed initialization"
    Jun 14 15:14:47 localhost dockerd[7333]: time="2019-06-14T15:14:47.923160567+08:00" level=info msg="API listen on /var/run/docker.sock"
    Jun 14 15:14:47 localhost systemd[1]: Started Docker Application Container Engine.
    -- Subject: Unit docker.service has finished start-up
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    -- 
    -- Unit docker.service has finished starting up.
    -- 
    -- The start-up result is done.
    
  2. 查看某个时间端的日志

    [[email protected]]#  journalctl -xu --since 11:30 --until 11:40 kubelet --no-pager
    ... ...
    Jul 03 11:36:53 host-57-86 kubelet[11191]: I0703 11:36:53.893873   11191 kubelet_node_status.go:283] Setting node annotation to enable volume controller attach/detach
    Jul 03 11:36:53 host-57-86 kubelet[11191]: I0703 11:36:53.900914   11191 kubelet_node_status.go:72] Attempting to register node host-57-86
    Jul 03 11:36:53 host-57-86 kubelet[11191]: E0703 11:36:53.902687   11191 kubelet_node_status.go:94] Unable to register node "host-57-86" with API server: nodes "host-57-86" is forbidden: node "host-86" is not allowed to modify node "host-57-86"
    ... ...