如何看日志报错 journalctl -xe

前言

你在启动服务时经常会出现报错信息,但你却不知道呢出现问题自己看半天也看不懂。
我们一起来解析下报错信息如何查看,英语不好的可以下载一个“网易有道翻译.
查看日志的命令是: journalctl -xe

启动失败反馈的结果:(案例一)
[root@localhost ~]# systemctl restart zabbix-server
Job for zabbix-server.service failed because a configured resource limit was exceeded. See "systemctl status zabbix-server.service" and "journalctl -xe" for details.
[root@localhost ~]# journalctl -xe
###日志内容如下
-- Unit zabbix-server.service has begun starting up.
Jul 08 09:12:46 localhost.localdomain systemd[1]: PID file /run/zabbix/zabbix_server.pid not readable (yet?) after start.
Jul 08 09:12:46 localhost.localdomain systemd[1]: zabbix-server.service never wrote its PID file. Failing.
Jul 08 09:12:46 localhost.localdomain systemd[1]: Failed to start Zabbix Server.
-- Subject: Unit zabbix-server.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit zabbix-server.service has failed.
-- 
-- The result is failed.
Jul 08 09:12:46 localhost.localdomain systemd[1]: Unit zabbix-server.service entered failed state.
Jul 08 09:12:46 localhost.localdomain systemd[1]: zabbix-server.service failed.

日志解析:案例1

[root@localhost ~]# journalctl -xe
###日志内容如下
-- Unit zabbix-server.service has begun starting up.
Jul 08 09:12:46 localhost.localdomain systemd[1]: PID file /run/zabbix/zabbix_server.pid not readable (yet?) after start.
##七月八号上午09:12:46本地系统领域[1]:  文件zabbix_server.pid不可读。

Jul 08 09:12:46 localhost.localdomain systemd[1]: zabbix-server.service never wrote its PID file. Failing.
##七月八号上午09:12:46本地系统领域[1]:  zabbix-server.server从来没有写过pid文件。失败的。

Jul 08 09:12:46 localhost.localdomain systemd[1]: Failed to start Zabbix Server.
##七月八号上午09:12:46本地系统领域[1]:  zabbix 服务启动失败

-- Subject: Unit zabbix-server.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit zabbix-server.service has failed.
-- 
-- The result is failed.
Jul 08 09:12:46 localhost.localdomain systemd[1]: Unit zabbix-server.service entered failed state.
Jul 08 09:12:46 localhost.localdomain systemd[1]: zabbix-server.service failed.

日志解析:案例2

启动失败反馈的结果:(案例二)
[root@sale-minion ~]# journalctl -ex
-- Unit salt-minion.service has finished starting up.
-- 
-- The start-up result is done.
Jul 09 02:47:22 sale-minion polkitd[630]: Unregistered Authentication Agent for unix-process:18264:1734617 (system bus name :1.143, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF
Jul 09 02:47:22 sale-minion salt-minion[18271]: /usr/lib/python2.7/site-packages/salt/scripts.py:212: DeprecationWarning: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Pyt
Jul 09 02:47:22 sale-minion salt-minion[18271]: [ERROR   ] Error parsing configuration file: /etc/salt/minion - while scanning a simple key
Jul 09 02:47:22 sale-minion salt-minion[18271]: in "/etc/salt/minion", line 112, column 1
Jul 09 02:47:22 sale-minion salt-minion[18271]: could not find expected ':'
Jul 09 02:47:22 sale-minion salt-minion[18271]: in "/etc/salt/minion", line 114, column 1
Jul 09 02:47:22 sale-minion salt-minion[18271]: [ERROR   ] Error parsing configuration file: /etc/salt/minion - while scanning a simple key

日志解析:(案例二)
[root@sale-minion ~]# journalctl -ex
-- Unit salt-minion.service has finished starting up.
-- 
-- The start-up result is done.
Jul 09 02:47:22 sale-minion polkitd[630]: Unregistered Authentication Agent for unix-process:18264:1734617 (system bus name :1.143, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF
Jul 09 02:47:22 sale-minion salt-minion[18271]: /usr/lib/python2.7/site-packages/salt/scripts.py:212: DeprecationWarning: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Pyt
Jul 09 02:47:22 sale-minion salt-minion[18271]: [ERROR   ] Error parsing configuration file: /etc/salt/minion - while scanning a simple key
Jul 09 02:47:22 sale-minion salt-minion[18271]: in "/etc/salt/minion", line 112, column 1
##七月九日 02:47:22 sale-minion salt-minion[18271]: 文件/etc/salt/minion下,第112行,第1列出问题。

Jul 09 02:47:22 sale-minion salt-minion[18271]: could not find expected ':'
##七月九日 02:47:22 sale-minion salt-minion[18271]:找不到期望,就启动失败,不对文件做出正确的修改格式就没救了。

Jul 09 02:47:22 sale-minion salt-minion[18271]: in "/etc/salt/minion", line 114, column 1
##七月九日 02:47:22 sale-minion salt-minion[18271]: 文件/etc/salt/minion下,第114行,第1列出问题。

Jul 09 02:47:22 sale-minion salt-minion[18271]: [ERROR   ] Error parsing configuration file: /etc/salt/minion - while scanning a simple key

你可能感兴趣的:(Linux技巧,1024程序员节)