Ali*_*Ali 2 linux linux-kernel
dmesg 打印的日志自两个月前以来就没有更新,即使我们上周有许多进程被 OOM 杀死。
dmesg 源是什么以及如何查找系统日志是否正常工作?
dmesg 输出:
[Mon Jul 6 21:56:27 2015] 736kB, rss:156kB, swap:0kB
[Fri Feb 26 11:11:43 2016] Out of memory in UB 6547: OOM killed process 15935 (getty) score 0 vm:12736kB, rss:156kB, swap:0kB
[Fri Feb 26 11:11:43 2016] Out of memory in UB 6547: OOM killed process 5898 (python) score 0 vm:1122780kB, rss:1063096kB, swap:0kB
[Fri Feb 26 13:50:13 2016] Out of memory in UB 6547: OOM killed process 3840 (getty) score 0 vm:12736kB, rss:152kB, swap:0kB
[Fri Feb 26 13:50:13 2016] Out of memory in UB 6547: OOM killed process 3841 (getty) score 0 vm:12736kB, rss:156kB, swap:0kB
[Fri Feb 26 13:50:13 2016] Out of memory in UB 6547: OOM killed process 6502 (getty) score 0 vm:12736kB, rss:168kB, swap:0kB
[Fri Feb 26 13:50:13 2016] Out of memory in UB 6547: OOM killed process 6504 (getty) score 0 vm:12736kB, rss:220kB, swap:0kB
[Fri Feb 26 13:50:14 2016] Out of memory in UB 6547: OOM killed process 6506 (getty) score 0 vm:12736kB, rss:328kB, swap:0kB
[Fri Feb 26 13:50:14 2016] Out of memory in UB 6547: OOM killed process 6508 (getty) score 0 vm:12736kB, rss:348kB, swap:0kB
[Fri Feb 26 13:50:14 2016] Out of memory in UB 6547: OOM killed process 6491 (python) score 0 vm:993704kB, rss:934084kB, swap:0kB
[Fri Feb 26 13:51:29 2016] Out of memory in UB 6547: OOM killed process 6510 (getty) score 0 vm:12736kB, rss:276kB, swap:0kB
[Fri Feb 26 13:51:29 2016] Out of memory in UB 6547: OOM killed process 6512 (getty) score 0 vm:12736kB, rss:276kB, swap:0kB
[Fri Feb 26 13:51:29 2016] Out of memory in UB 6547: OOM killed process 6534 (getty) score 0 vm:12736kB, rss:320kB, swap:0kB
[Fri Feb 26 13:51:29 2016] Out of memory in UB 6547: OOM killed process 6536 (getty) score 0 vm:12736kB, rss:316kB, swap:0kB
[Fri Feb 26 13:51:29 2016] Out of memory in UB 6547: OOM killed process 6525 (python) score 0 vm:992252kB, rss:932812kB, swap:0kB
[Fri Feb 26 13:52:09 2016] Out of memory in UB 6547: OOM killed process 6538 (getty) score 0 vm:12736kB, rss:276kB, swap:0kB
[Fri Feb 26 13:52:09 2016] Out of memory in UB 6547: OOM killed process 6540 (getty) score 0 vm:12736kB, rss:280kB, swap:0kB
[Fri Feb 26 13:52:09 2016] Out of memory in UB 6547: OOM killed process 6576 (getty) score 0 vm:12736kB, rss:284kB, swap:0kB
[Fri Feb 26 13:52:09 2016] Out of memory in UB 6547: OOM killed process 6578 (getty) score 0 vm:12736kB, rss:360kB, swap:0kB
[Fri Feb 26 13:52:09 2016] Out of memory in UB 6547: OOM killed process 6580 (getty) score 0 vm:12736kB, rss:332kB, swap:0kB
[Fri Feb 26 13:52:09 2016] Out of memory in UB 6547: OOM killed process 6582 (getty) score 0 vm:12736kB, rss:320kB, swap:0kB
[Fri Feb 26 13:52:09 2016] Out of memory in UB 6547: OOM killed process 6584 (getty) score 0 vm:6428kB, rss:356kB, swap:0kB
[Fri Feb 26 13:52:09 2016] Out of memory in UB 6547: OOM killed process 6586 (getty) score 0 vm:6428kB, rss:440kB, swap:0kB
[Fri Feb 26 13:52:09 2016] Out of memory in UB 6547: OOM killed process 6588 (getty) score 0 vm:12736kB, rss:372kB, swap:0kB
[Fri Feb 26 13:52:09 2016] Out of memory in UB 6547: OOM killed process 6589 (getty) score 0 vm:12736kB, rss:404kB, swap:0kB
[Fri Feb 26 13:52:09 2016] OOM killer in rage, 1 tasks killed
[Fri Feb 26 13:52:09 2016] OOM killer in rage, 1 tasks killed
[Fri Feb 26 13:52:09 2016] OOM killer in rage, 1 tasks killed
[Fri Feb 26 13:52:10 2016] OOM killer in rage, 1 tasks killed
[Fri Feb 26 13:52:10 2016] Out of memory in UB 6547: OOM killed process 1126 (beam.smp) score 0 vm:2922908kB, rss:508796kB, swap:0kB
[Sun Feb 28 09:48:26 2016] Out of memory in UB 6547: OOM killed process 6593 (getty) score 0 vm:12736kB, rss:156kB, swap:0kB
[Sun Feb 28 09:48:26 2016] Out of memory in UB 6547: OOM killed process 6597 (getty) score 0 vm:12736kB, rss:148kB, swap:0kB
[Sun Feb 28 09:48:26 2016] Out of memory in UB 6547: OOM killed process 4354 (python) score 0 vm:2192548kB, rss:2056640kB, swap:0kB
[Sun Feb 28 13:57:25 2016] Out of memory in UB 6547: OOM killed process 11648 (getty) score 0 vm:12736kB, rss:160kB, swap:0kB
[Sun Feb 28 13:57:25 2016] Out of memory in UB 6547: OOM killed process 11649 (getty) score 0 vm:12736kB, rss:152kB, swap:0kB
[Sun Feb 28 13:57:25 2016] Out of memory in UB 6547: OOM killed process 6599 (cron) score 0 vm:23604kB, rss:232kB, swap:0kB
[Sun Feb 28 13:57:25 2016] Out of memory in UB 6547: OOM killed process 30284 (java) score 0 vm:3811464kB, rss:463996kB, swap:0kB
Run Code Online (Sandbox Code Playgroud)
似乎服务器时间在一段时间内是错误的(2016年)(我不知道为什么),但现在已修复:
ali@server:~$ date
Mon Aug 31 04:14:05 EDT 2015
Run Code Online (Sandbox Code Playgroud)
什么是 dmesg 源码: dmesg 读取存储在内核缓冲区 log_buf 中的日志。dmesg 立即读取 printk 缓冲区并将其转储到 shell 上。
cat /proc/kmsg 可用于查看日志是否存储在 printk 缓冲区中,该缓冲区在存储时不断读取 printk 日志。
但是正如您上周尝试杀死进程并且它在 dmesg 中显示这些日志一样,所以我建议您检查系统的日期和时间设置。