[步骤] Linux journal 日志的永久存储

正文:

步骤一:理解 journal 日志存储机制

默认情况下,journal 的日志存储在 /run/log/journal,而 /run 目录只是一个临时目录。

将 Storage 参数设置为 persistent 后,journal 的日志将存储在 /var/log/journal,/var/log 则是一个永久的目录。

步骤二:将 journal 日志设置为永久存储

2.1 修改 /etc/systemd/journald.conf 文件

# vi /etc/systemd/journald.conf

将部分内容修改如下:

[Journal]
......
Storage=persistent
......

2.2 重启 systemd-journald 服务

# systemctl restart systemd-journald.service

参考文献:

https://linuxconfig.org/introduction-to-the-systemd-journal

[排错] Linux 解决日志里报错 “kernel: [829455.595333][ C10] critical target error, dev sda, sector 104056241 op 0x3:(DISCARD) ……”

报错代码:

kernel: [829455.595333][ C10] critical target error, dev sda, sector 104056241 op 0x3:(DISCARD) ......

分析:

如果是在 VMware 上运行的虚拟机在日志里出现 critical target error 此类报错,尤其是涉及到 DISCARD 操作的错误,通常是由 VMware 进行硬盘垃圾空间回收或者进行硬盘优化造成的。

解决方法:

VMware 的控制平台上,检查宿主机的硬盘是否正常。若不正常则修复或者更换硬盘。

[步骤] SLE supportconfig 命令收集选项的设置

步骤一:supportconfig 的作用理解

supportconfig 是一个 SLE 系统搜集系统整体情况的命令,我们可以选择搜集哪些信息

步骤二:supportconfig 命令收集选项的设置

2.1 创建 /etc/supportconfig.conf 文件

# supportconfig -C

2.2 让 supportconfig 命令不搜集某些信息

# sed -i 's\OPTION_AUDIT=1\OPTION_AUDIT=0\g' /etc/supportconfig.conf

(补充:这里使 supportconfig 命令不搜集 audit 日志为例)

Several situations of Linux automatically reboot without reboot logs in the /var/log/messages

Situation One

This Linux server is a virtual server. If we reboot it though its virtual software, there is no relevant logs in the /var/log/messages.

Situation Two

This Linux server is a member of a pacemaker cluster. If the pacemaker cluster software fences this server for protecting the whole cluster, there is no relate logs in the /var/log/messages.

Situation Three

This Linux server has critical problems in its system or hardware. Core panic of Linux and hardware problem both can reboot the system automatically without any reboot logs in the /var/log/messages.