当前位置:网站首页>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.
边栏推荐
- Pg_relation_size 问题
- UI gesture actions of uiautomator common classes
- 查看服务器重启前的 dmesg 日志
- 临界区(critical section 每个线程中访问 临界资源 的那段代码)和互斥锁(mutex)的区别(进程间互斥量、共享内存、虚拟地址)
- Drconv pytorch is changed to the same size of output and input
- Use of tigervnc
- (2022杭电多校三)1011.Taxi(曼哈顿最值+二分)
- Will Flink CDC constantly occupy Oracle's memory by extracting Oracle's data, and finally cause oracle-040
- Examples of Oracle triggers
- docker安装MySQL8.0.28
猜你喜欢

Tcp/ip protocol analysis (tcp/ip three handshakes & four waves + OSI & TCP / IP model)

Gossip: Recently, many friends talk about going abroad

Which C4d cloud rendering platform to cooperate with?

Use of tigervnc

VLAN trunk实验

Synchronized锁

js中的数组方法与循环

Usage of string class

Essay: college entrance examination

(posted) comparison of Eureka, consumer and Nacos 1
随机推荐
Tableau prep is connected to maxcompute and only writes simple SQL. Why is this error reported?
Analysis of memory structure of C program code
Haikang H9 camera cannot be connected with xshell (SSH is not enabled)
?实验 7 基于 Mysql 的 PHP 管理系统实现
UI gesture actions of uiautomator common classes
Binary tree -- natural search semantics (1) Basics
Li Mu hands-on learning, in-depth learning, V2 transformer and code implementation
Drconv pytorch is changed to the same size of output and input
Jmeter: interface automation test - BeanShell compares database data and return data
Federal Reserve SR 11-7: Guidance on model risk management - Wanzi collection
C语言实现猜数字小游戏项目实战(基于srand函数、rand函数,Switch语句、while循环、if条件判据等)
【golang学习笔记2.0】 golang中的数组和切片
软件测试十大必问面试题(附答案和解析)
VLAN trunk experiment
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
Instruction set x digital technology accelerates the digital transformation of government and enterprises, and builds Unicorn enterprise alliance in DT field
C# 常用功能整合-3
Internal class -- just read this article~
DRConv-pytorch改称输出和输入一样的尺寸
Advanced IO outline