当前位置:网站首页>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.
边栏推荐
- Tcp/ip protocol analysis (tcp/ip three handshakes & four waves + OSI & TCP / IP model)
- Oracle 组合查询
- [wsl2] configure the USB camera connecting the USB device and using the host
- C语言实现猜数字小游戏项目实战(基于srand函数、rand函数,Switch语句、while循环、if条件判据等)
- Perl: 将要执行的外部命令拆分为多行
- Using loops to process data in tables in kettle
- Excuse me, MySQL timestamp (6) using flick SQL is null. Is there a way to deal with this
- UUID and secrets module
- (2022杭电多校三)1009.Package Delivery(贪心)
- vlan间路由(讲解+验证)
猜你喜欢

Using loops to process data in tables in kettle

Array method and loop in JS

How to submit C4d animation to cloud rendering farm for fast rendering?

C4D云渲染平台选哪家合作?

VLAN trunk experiment

C语言实现猜数字小游戏项目实战(基于srand函数、rand函数,Switch语句、while循环、if条件判据等)

C4D动画如何提交云渲染农场快速渲染?

Generics -- learn it, and there are many benefits

Firefox browser, when accessing Tencent cloud server, failed to establish a secure connection.

tigervnc的使用
随机推荐
Sort increment with typescript
利用 Amazon DynamoDB 和 Amazon S3 结合 gzip 压缩,最大化存储玩家数据
单元测试系统化讲解之Mockito
闭散列和开散列解决哈希冲突
Pg_relation_size 问题
Cadence(十一)丝印调整和后续事项
IO中节点流和处理流的理解学习
DRConv-pytorch改称输出和输入一样的尺寸
Port forwarding summary
36 - new promise method: allsettled & any & race
tigervnc的使用
Demonstrate the use of foreign keys with Oracle
Esp8266 (esp-12f) third party library use -- sparkfun_ Apds9960 (gesture recognition)
整体二分?
UI gesture actions of uiautomator common classes
Functools module
Pytorch notes: td3
Py2exe QT interface style becomes Win98 solution
用shell来计算文本中的数字之和
(2022 Niuke multi school III) j-journey (Dijkstra)