如何阻止 Kern.log 和 Syslog 过度增长

如何阻止 Kern.log 和 Syslog 过度增长

我遇到了这个问题,在全新安装 Ubuntu 20.04 时,我的 kern.log 和 syslog 文件每小时都会变大。总是出现相同的行我有一个 Wifi 适配器,我不明白安装时我做错了什么。有一些日志

内核日志

Mar 18 07:38:46 STARSHIP kernel: [    5.645129] Generic FE-GE Realtek PHY r8169-400:00: attached PHY driver [Generic FE-GE Realtek PHY] (mii_bus:phy_addr=r8169-400:00, irq=IGNORE)
Mar 18 07:38:46 STARSHIP kernel: [    5.801212] aufs 5.x-rcN-20200622
Mar 18 07:38:46 STARSHIP kernel: [    5.833050] r8169 0000:04:00.0 enp4s0: Link is Down
Mar 18 07:38:47 STARSHIP kernel: [    6.279906] pcieport 0000:00:1c.5: AER: Corrected error received: 0000:00:1c.5
Mar 18 07:38:47 STARSHIP kernel: [    6.279924] pcieport 0000:00:1c.5: AER: PCIe Bus Error: severity=Corrected, type=Physical Layer, (Receiver ID)
Mar 18 07:38:47 STARSHIP kernel: [    6.279926] pcieport 0000:00:1c.5: AER:   device [8086:a295] error status/mask=00000001/00002000
Mar 18 07:38:47 STARSHIP kernel: [    6.279927] pcieport 0000:00:1c.5: AER:    [ 0] RxErr
Mar 18 07:38:47 STARSHIP kernel: [    6.279941] pcieport 0000:00:1c.5: AER: Corrected error received: 0000:00:1c.5
Mar 18 07:38:47 STARSHIP kernel: [    6.279955] pcieport 0000:00:1c.5: AER: can't find device of ID00e5
Mar 18 07:38:47 STARSHIP kernel: [    6.279956] pcieport 0000:00:1c.5: AER: Corrected error received: 0000:00:1c.5
Mar 18 07:38:47 STARSHIP kernel: [    6.279969] pcieport 0000:00:1c.5: AER: can't find device of ID00e5
Mar 18 07:38:47 STARSHIP kernel: [    6.279970] pcieport 0000:00:1c.5: AER: Corrected error received: 0000:00:1c.5
Mar 18 07:38:47 STARSHIP kernel: [    6.279985] pcieport 0000:00:1c.5: AER: can't find device of ID00e5
Mar 18 07:38:47 STARSHIP kernel: [    6.279986] pcieport 0000:00:1c.5: AER: Multiple Corrected error received: 0000:00:1c.5

系统日志

Mar 18 07:38:54 STARSHIP kernel: [   13.164969] pcieport 0000:00:1c.5: AER: Multiple Corrected error received: 0000:00:1c.5
Mar 18 07:38:54 STARSHIP kernel: [   13.164978] pcieport 0000:00:1c.5: AER: PCIe Bus Error: severity=Corrected, type=Physical Layer, (Receiver ID)
Mar 18 07:38:54 STARSHIP kernel: [   13.164979] pcieport 0000:00:1c.5: AER:   device [8086:a295] error status/mask=00000001/00002000
Mar 18 07:38:54 STARSHIP kernel: [   13.164980] pcieport 0000:00:1c.5: AER:    [ 0] RxErr
Mar 18 07:38:54 STARSHIP kernel: [   13.164990] pcieport 0000:00:1c.5: AER: Corrected error received: 0000:00:1c.5
Mar 18 07:38:54 STARSHIP kernel: [   13.165041] pcieport 0000:00:1c.5: AER: can't find device of ID00e5
Mar 18 07:38:54 STARSHIP kernel: [   13.165063] pcieport 0000:00:1c.5: AER: Corrected error received: 0000:00:1c.5
Mar 18 07:38:54 STARSHIP kernel: [   13.165069] pcieport 0000:00:1c.5: AER: PCIe Bus Error: severity=Corrected, type=Physical Layer, (Receiver ID)
Mar 18 07:38:54 STARSHIP kernel: [   13.165070] pcieport 0000:00:1c.5: AER:   device [8086:a295] error status/mask=00000001/00002000
Mar 18 07:38:54 STARSHIP kernel: [   13.165071] pcieport 0000:00:1c.5: AER:    [ 0] RxErr

任何帮助解决这个问题的帮助都会非常感激

答案1

当您在日志中收到错误消息时,最好的选择始终是找出根本问题是什么。

但是,如果一切似乎都正常,但你仍然在日志中收到垃圾邮件,那么可以采用以下方法过滤掉这些消息:

  1. 创建一个新文件/etc/rsyslog.d(这里我使用名称01-block-pcieport.conf

    sudo touch /etc/rsyslog.d/01-block-pcieport.conf

  2. 输入以下内容01-block-pcieport.conf

    if $msg contains "pcieport 0000:00:1c.5" then { stop }

这将过滤掉相关的所有日志消息pcieport 0000:00:1c.5,并且您将无法再使用日志来排除该设备的故障。

因此,再次强调,强烈建议在过滤此类消息之前先找到根本原因。我想知道这是否是驱动程序问题?我认为您应该先调查一下这个问题。

相关内容