龙空技术网

linux查询服务的日志

踏入风雨梦中行 426

前言:

如今兄弟们对“centos日志服务”大致比较讲究,大家都想要知道一些“centos日志服务”的相关内容。那么小编也在网摘上收集了一些关于“centos日志服务””的相关知识,希望我们能喜欢,姐妹们一起来学习一下吧!

当在linux服务器上启动一个服务时,可能会出现问题,这时可以使用`journalctl`命令来查询日志。

journalctl命令格式:journalctl -u [服务名]

查看docker服务的启动日志:

journalctl -u docker
[root@XXX ~]# journalctl -u docker-- Logs begin at Mon 2021-11-08 20:54:10 CST, end at Mon 2022-05-09 00:05:47 CST. --Nov 16 17:17:47 VM-24-15-centos systemd[1]: Starting Docker Application Container Engine...Nov 16 17:17:47 VM-24-15-centos dockerd-current[5128]: time="2021-11-16T17:17:47.157714658+08:00" level=warning msg="could not change group /var/run/docker.sock toNov 16 17:17:47 VM-24-15-centos dockerd-current[5128]: time="2021-11-16T17:17:47.158785574+08:00" level=info msg="libcontainerd: new containerd process, pid: 5136"Nov 16 17:17:48 VM-24-15-centos dockerd-current[5128]: time="2021-11-16T17:17:48.163826317+08:00" level=warning msg="Docker could not enable SELinux on the host syNov 16 17:17:48 VM-24-15-centos dockerd-current[5128]: time="2021-11-16T17:17:48.191359221+08:00" level=info msg="Graph migration to content-addressability took 0.Nov 16 17:17:48 VM-24-15-centos dockerd-current[5128]: time="2021-11-16T17:17:48.191765409+08:00" level=info msg="Loading containers: start."Nov 16 17:17:48 VM-24-15-centos dockerd-current[5128]: time="2021-11-16T17:17:48.224387152+08:00" level=info msg="Firewalld running: false"Nov 16 17:17:48 VM-24-15-centos dockerd-current[5128]: time="2021-11-16T17:17:48.281860159+08:00" level=info msg="Default bridge (docker0) is assigned with an IP aNov 16 17:17:48 VM-24-15-centos dockerd-current[5128]: time="2021-11-16T17:17:48.307863111+08:00" level=info msg="Loading containers: done."Nov 16 17:17:48 VM-24-15-centos dockerd-current[5128]: time="2021-11-16T17:17:48.417739043+08:00" level=info msg="Daemon has completed initialization"Nov 16 17:17:48 VM-24-15-centos dockerd-current[5128]: time="2021-11-16T17:17:48.417775470+08:00" level=info msg="Docker daemon" commit="7d71120/1.13.1" graphdriveNov 16 17:17:48 VM-24-15-centos systemd[1]: Started Docker Application Container Engine.

查看详细日志,可以将日志信息导入到文件中:

journalctl -u docker > a.txtvim a.txt

标签: #centos日志服务