当前位置:网站首页>View the dmesg log before server restart
View the dmesg log before server restart
2022-07-27 07:28:00 【TechForGeek】
notes : The sample code in this article is Ubuntu Execute... In the system , other Linux The distribution operation is similar .
Scene description
In the daily operation and maintenance work , Inevitably, we will encounter the problem of server failure . Although in application operation and maintenance or SRE post , You don't have to repair the server yourself , But it is necessary to investigate the cause of the problem , In order to submit the repair order later .
In various types of server failures , One kind is like this :
One day , The server suddenly fails to log in , After the server restarts, it returns to normal .
After the server restarts and returns to normal , We log in to the server , It is necessary to judge whether the fault is caused by hardware problems , If there is a hardware problem , Usually in dmesg It is reflected in the log .
The problem is , After every server restart , Log in to the machine and execute dmesg command , Can only show the log after this restart , You can't see the log before restarting . In order to find out the cause of server failure , You must see the before restart dmesg journal .
Ubuntu < 15.04
Now use less than Ubuntu 15.04 There should be few people in this version , But if you are using these old Ubuntu System words , In your /var/log/ Under the table of contents , There will be a log file with the following name :
dmesg
dmesg.0
dmesg.1.gz
...dmesg What is saved in the log file is the log after this restart , and dmesg.0 It was before this restart dmesg journal ,dmesg.1.gz It was before the last restart dmesg journal , By analogy .
By looking at dmesg.0 The contents of the log file , You can see the before the server restarts dmesg Log .
Ubuntu >= 15.04
Now more people use Ubuntu Should be 15.04 Later versions .Ubuntu from 15.04 Start using systemd, systemd There is a logging service in , be known as journald, Through command line tools journalctl It's easy to get journald Recorded log , This includes dmesg journal .
To view the before server restart dmesg journal , You can use the following command :
journalctl -k -b -1-k: Indicates to view dmesg journal
-b -1: It means to check the log before the server restarts
Conclusion
When troubleshooting the server ,dmesg Logs are a very useful source of information . If you're using Ubuntu 15.04 Previous systems ,/var/log/dmesg.0 Before restart dmesg journal ; If you use it Ubuntu 15.04 After the system , adopt journalctl Command you can easily view the information before the server restarts dmesg journal .
As always, , If you have any questions about the content of the article , Or find any mistakes in the article , You can tell me by leaving a message ; If you like my article , Welcome to my WeChat official account. Tech For Geek.
边栏推荐
猜你喜欢
随机推荐
Flutter实战-请求封装(一)
Array method and loop in JS
js做一个红绿灯
Py2exe QT interface style becomes Win98 solution
【WSL2】配置连接 USB 设备并使用主机的 USB 摄像头
The error of QT connecting SQLite database and its modification
(2022杭电多校三)1011.Taxi(曼哈顿最值+二分)
用shell来计算文本中的数字之和
ShowDoc漏洞学习——CNVD-2020-26585(任意文件上传)
优炫数据库主要线程有哪些?
请问有人使用oracle xstream 时出现个别capture延迟很大的吗,该如何解决延迟问题呢
单臂路由(讲解+实验)
Turn off the auto start function of Oracle service in centos7
多线程【初阶-上篇】
Pytorch notes: td3
C language pthread_ cleanup_ Push() and pthread_ cleanup_ Pop() function (used for the resource cleaning task after the termination action in the critical resource program segment to avoid deadlock. T
Logcat tool
35. Search Insert Position 搜索插入位置
Internal class -- just read this article~
Using docker in MAC to build Oracle database server








