将网络日志从 syslog 重定向到另一个文件

将网络日志从 syslog 重定向到另一个文件

我一直在记录太多信息(目前不需要)syslog,不是每天或每小时...而是即时的。如果我想在我的记录中查看某些内容,syslog我就是无法做到,因为网络日志一直在干扰。

那么,我如何才能将网络日志重定向到另一个文件和/或停止记录它?

Dec 10 17:01:33 user kernel: [ 8716.000587] MediaState is connected
Dec 10 17:01:33 user kernel: [ 8716.000599] ==>rt_ioctl_giwmode(mode=2)
Dec 10 17:01:33 user kernel: [ 8716.000601] ==>rt_ioctl_giwfreq  11
Dec 10 17:01:33 user kernel: [ 8716.000612] rt28xx_get_wireless_stats --->
Dec 10 17:01:33 user kernel: [ 8716.000615] <--- rt28xx_get_wireless_stats
Dec 10 17:01:39 user kernel: [ 8722.000714] MediaState is connected
Dec 10 17:01:39 user kernel: [ 8722.000729] ==>rt_ioctl_giwmode(mode=2)
Dec 10 17:01:39 user kernel: [ 8722.000732] ==>rt_ioctl_giwfreq  11
Dec 10 17:01:39 user kernel: [ 8722.000747] rt28xx_get_wireless_stats --->
Dec 10 17:01:39 user kernel: [ 8722.000751] <--- rt28xx_get_wireless_stats
Dec 10 17:01:44 user kernel: [ 8726.904025] QuickDRS: TxTotalCnt <= 15, train back to original rate 
Dec 10 17:01:45 user kernel: [ 8728.003138] MediaState is connected
Dec 10 17:01:45 user kernel: [ 8728.003153] ==>rt_ioctl_giwmode(mode=2)
Dec 10 17:01:45 user kernel: [ 8728.003157] ==>rt_ioctl_giwfreq  11
Dec 10 17:01:45 user kernel: [ 8728.003171] rt28xx_get_wireless_stats --->
Dec 10 17:01:45 user kernel: [ 8728.003175] <--- rt28xx_get_wireless_stats
Dec 10 17:01:51 user kernel: [ 8734.004066] MediaState is connected
Dec 10 17:01:51 user kernel: [ 8734.004079] ==>rt_ioctl_giwmode(mode=2)
Dec 10 17:01:51 user kernel: [ 8734.004082] ==>rt_ioctl_giwfreq  11
Dec 10 17:01:51 user kernel: [ 8734.004096] rt28xx_get_wireless_stats --->
Dec 10 17:01:51 user kernel: [ 8734.004099] <--- rt28xx_get_wireless_stats
Dec 10 17:01:57 user kernel: [ 8740.004108] MediaState is connected
Dec 10 17:01:57 user kernel: [ 8740.004119] ==>rt_ioctl_giwmode(mode=2)
Dec 10 17:01:57 user kernel: [ 8740.004121] ==>rt_ioctl_giwfreq  11
Dec 10 17:01:57 user kernel: [ 8740.004132] rt28xx_get_wireless_stats --->
Dec 10 17:01:57 user kernel: [ 8740.004135] <--- rt28xx_get_wireless_stats
Dec 10 17:01:57 user kernel: [ 8740.436021] QuickDRS: TxTotalCnt <= 15, train back to original rate 
Dec 10 17:02:03 user kernel: [ 8746.005280] MediaState is connected
Dec 10 17:02:03 user kernel: [ 8746.005294] ==>rt_ioctl_giwmode(mode=2)
Dec 10 17:02:03 user kernel: [ 8746.005298] ==>rt_ioctl_giwfreq  11
Dec 10 17:02:03 user kernel: [ 8746.005312] rt28xx_get_wireless_stats --->
Dec 10 17:02:03 user kernel: [ 8746.005315] <--- rt28xx_get_wireless_stats
Dec 10 17:02:09 user kernel: [ 8752.004790] MediaState is connected
Dec 10 17:02:09 user kernel: [ 8752.004804] ==>rt_ioctl_giwmode(mode=2)
Dec 10 17:02:09 user kernel: [ 8752.004808] ==>rt_ioctl_giwfreq  11
Dec 10 17:02:09 user kernel: [ 8752.004821] rt28xx_get_wireless_stats --->
Dec 10 17:02:09 user kernel: [ 8752.004825] <--- rt28xx_get_wireless_stats
Dec 10 17:02:15 user kernel: [ 8757.984031] QuickDRS: TxTotalCnt <= 15, train back to original rate 
Dec 10 17:02:15 user kernel: [ 8758.004078] MediaState is connected
Dec 10 17:02:15 user kernel: [ 8758.004094] ==>rt_ioctl_giwmode(mode=2)
Dec 10 17:02:15 user kernel: [ 8758.004097] ==>rt_ioctl_giwfreq  11
Dec 10 17:02:15 user kernel: [ 8758.004112] rt28xx_get_wireless_stats --->
Dec 10 17:02:15 user kernel: [ 8758.004116] <--- rt28xx_get_wireless_stats
Dec 10 17:02:16 user kernel: [ 8759.492017] QuickDRS: TxTotalCnt <= 15, train back to original rate 
Dec 10 17:02:19 user kernel: [ 8762.002179] SCANNING, suspend MSDU transmission ...
Dec 10 17:02:19 user kernel: [ 8762.004291] MlmeScanReqAction -- Send PSM Data frame for off channel RM, SCAN_IN_PROGRESS=1!
Dec 10 17:02:19 user kernel: [ 8762.025055] SYNC - BBP R4 to 20MHz.l
Dec 10 17:02:19 user kernel: [ 8762.027249] RT35xx: SwitchChannel#1(RF=8, Pwr0=30, Pwr1=25, 2T), N=0xF1, K=0x02, R=0x02
Dec 10 17:02:19 user kernel: [ 8762.170206] RT35xx: SwitchChannel#2(RF=8, Pwr0=30, Pwr1=25, 2T), N=0xF1, K=0x07, R=0x02
Dec 10 17:02:19 user kernel: [ 8762.318211] RT35xx: SwitchChannel#3(RF=8, Pwr0=30, Pwr1=25, 2T), N=0xF2, K=0x02, R=0x02
Dec 10 17:02:19 user kernel: [ 8762.462269] RT35xx: SwitchChannel#4(RF=8, Pwr0=30, Pwr1=25, 2T), N=0xF2, K=0x07, R=0x02
Dec 10 17:02:19 user kernel: [ 8762.606229] RT35xx: SwitchChannel#5(RF=8, Pwr0=30, Pwr1=25, 2T), N=0xF3, K=0x02, R=0x02
Dec 10 17:02:19 user kernel: [ 8762.750202] RT35xx: SwitchChannel#6(RF=8, Pwr0=30, Pwr1=25, 2T), N=0xF3, K=0x07, R=0x02
Dec 10 17:02:20 user kernel: [ 8762.894217] RT35xx: SwitchChannel#7(RF=8, Pwr0=29, Pwr1=26, 2T), N=0xF4, K=0x02, R=0x02
Dec 10 17:02:20 user kernel: [ 8763.038202] RT35xx: SwitchChannel#11(RF=8, Pwr0=29, Pwr1=26, 2T), N=0xF6, K=0x02, R=0x02
Dec 10 17:02:20 user kernel: [ 8763.040194] CntlEnqueueForRecv(): BAR-Wcid(1), Tid (0)
Dec 10 17:02:20 user kernel: [ 8763.040199] BAR(1) : Tid (0) - 03a3:037e
Dec 10 17:02:20 user kernel: [ 8763.040387] SYNC - End of SCAN, restore to channel 11, Total BSS[03]
Dec 10 17:02:20 user kernel: [ 8763.040400] ScanNextChannel -- Send PSM Data frame
Dec 10 17:02:20 user kernel: [ 8763.040402] bFastRoamingScan ~~~~~~~~~~~~~ Get back to send data ~~~~~~~~~~~~~
Dec 10 17:02:20 user kernel: [ 8763.040405] SCAN done, resume MSDU transmission ...
Dec 10 17:02:20 user kernel: [ 8763.047022] CntlEnqueueForRecv(): BAR-Wcid(1), Tid (0)
Dec 10 17:02:20 user kernel: [ 8763.047026] BAR(1) : Tid (0) - 03a3:03a5
Dec 10 17:02:21 user kernel: [ 8763.898130] bImprovedScan ............. Resume for bImprovedScan, SCAN_PENDING .............. 
Dec 10 17:02:21 user kernel: [ 8763.898143] SCANNING, suspend MSDU transmission ...
Dec 10 17:02:21 user kernel: [ 8763.900245] MlmeScanReqAction -- Send PSM Data frame for off channel RM, SCAN_IN_PROGRESS=1!
Dec 10 17:02:21 user kernel: [ 8763.921144] SYNC - BBP R4 to 20MHz.l
Dec 10 17:02:21 user kernel: [ 8763.923339] RT35xx: SwitchChannel#8(RF=8, Pwr0=29, Pwr1=26, 2T), N=0xF4, K=0x07, R=0x02
Dec 10 17:02:21 user kernel: [ 8763.996019] QuickDRS: TxTotalCnt <= 15, train back to original rate 
Dec 10 17:02:21 user kernel: [ 8764.066221] RT35xx: SwitchChannel#9(RF=8, Pwr0=29, Pwr1=26, 2T), N=0xF5, K=0x02, R=0x02
Dec 10 17:02:21 user kernel: [ 8764.210212] RT35xx: SwitchChannel#10(RF=8, Pwr0=29, Pwr1=26, 2T), N=0xF5, K=0x07, R=0x02
Dec 10 17:02:21 user kernel: [ 8764.215536] CntlEnqueueForRecv(): BAR-Wcid(1), Tid (0)
Dec 10 17:02:21 user kernel: [ 8764.215542] BAR(1) : Tid (0) - 0457:0452
Dec 10 17:02:21 user kernel: [ 8764.244000] CntlEnqueueForRecv(): BAR-Wcid(1), Tid (0)
Dec 10 17:02:21 user kernel: [ 8764.244004] BAR(1) : Tid (0) - 0459:0456
Dec 10 17:02:21 user kernel: [ 8764.253019] CntlEnqueueForRecv(): BAR-Wcid(1), Tid (0)
Dec 10 17:02:21 user kernel: [ 8764.253023] BAR(1) : Tid (0) - 045c:0458
Dec 10 17:02:21 user kernel: [ 8764.256677] CntlEnqueueForRecv(): BAR-Wcid(1), Tid (0)
Dec 10 17:02:21 user kernel: [ 8764.256681] BAR(1) : Tid (0) - 045c:045b
Dec 10 17:02:21 user kernel: [ 8764.259785] CntlEnqueueForRecv(): BAR-Wcid(1), Tid (0)
Dec 10 17:02:21 user kernel: [ 8764.259788] BAR(1) : Tid (0) - 045d:045b
Dec 10 17:02:21 user kernel: [ 8764.280467] CntlEnqueueForRecv(): BAR-Wcid(1), Tid (0)
Dec 10 17:02:21 user kernel: [ 8764.280471] BAR(1) : Tid (0) - 045f:045c
Dec 10 17:02:21 user kernel: [ 8764.282189] CntlEnqueueForRecv(): BAR-Wcid(1), Tid (0)
Dec 10 17:02:21 user kernel: [ 8764.282192] BAR(1) : Tid (0) - 045f:045e
Dec 10 17:02:21 user kernel: [ 8764.354204] RT35xx: SwitchChannel#11(RF=8, Pwr0=29, Pwr1=26, 2T), N=0xF6, K=0x02, R=0x02
Dec 10 17:02:21 user kernel: [ 8764.356408] ScanNextChannel():Send PWA NullData frame to notify the associated AP!
Dec 10 17:02:21 user kernel: [ 8764.498202] RT35xx: SwitchChannel#12(RF=8, Pwr0=29, Pwr1=26, 2T), N=0xF6, K=0x07, R=0x02
Dec 10 17:02:21 user kernel: [ 8764.642210] RT35xx: SwitchChannel#13(RF=8, Pwr0=30, Pwr1=28, 2T), N=0xF7, K=0x02, R=0x02
Dec 10 17:02:22 user kernel: [ 8764.790229] RT35xx: SwitchChannel#14(RF=8, Pwr0=30, Pwr1=28, 2T), N=0xF8, K=0x04, R=0x02
Dec 10 17:02:22 user kernel: [ 8764.934238] RT35xx: SwitchChannel#11(RF=8, Pwr0=29, Pwr1=26, 2T), N=0xF6, K=0x02, R=0x02
Dec 10 17:02:22 user kernel: [ 8764.935243] CntlEnqueueForRecv(): BAR-Wcid(1), Tid (0)
Dec 10 17:02:22 user kernel: [ 8764.935249] BAR(1) : Tid (0) - 048e:0485
Dec 10 17:02:22 user kernel: [ 8764.936423] SYNC - End of SCAN, restore to channel 11, Total BSS[05]
Dec 10 17:02:22 user kernel: [ 8764.936436] ScanNextChannel -- Send PSM Data frame
Dec 10 17:02:22 user kernel: [ 8764.936440] SCAN done, resume MSDU transmission ...
Dec 10 17:02:22 user kernel: [ 8764.940529] RT35xx: SwitchChannel#11(RF=8, Pwr0=29, Pwr1=26, 2T), N=0xF6, K=0x02, R=0x02
Dec 10 17:02:22 user kernel: [ 8764.942178] CntlEnqueueForRecv(): BAR-Wcid(1), Tid (0)
Dec 10 17:02:22 user kernel: [ 8764.942182] BAR(1) : Tid (0) - 0493:048e
Dec 10 17:02:22 user kernel: [ 8764.942715] CNTL - All roaming failed, restore to channel 11, Total BSS[05]
Dec 10 17:02:22 user kernel: [ 8764.948016] MMCHK - No BEACON. restore R66 to the low bound(56) 
Dec 10 17:02:22 user kernel: [ 8764.948307] ===>rt_ioctl_giwscan. 5(5) BSS returned, data->length = 1111
Dec 10 17:02:23 user kernel: [ 8766.048073] QuickDRS: TxTotalCnt <= 15, train back to original rate 
Dec 10 17:02:23 user kernel: [ 8766.552034] QuickDRS: TxTotalCnt <= 15, train back to original rate 
Dec 10 17:02:27 user kernel: [ 8770.001180] MediaState is connected
Dec 10 17:02:27 user kernel: [ 8770.001197] ==>rt_ioctl_giwmode(mode=2)
Dec 10 17:02:27 user kernel: [ 8770.001201] ==>rt_ioctl_giwfreq  11
Dec 10 17:02:27 user kernel: [ 8770.001219] rt28xx_get_wireless_stats --->
Dec 10 17:02:27 user kernel: [ 8770.001223] <--- rt28xx_get_wireless_stats
Dec 10 17:02:28 user kernel: [ 8771.564020] QuickDRS: TxTotalCnt <= 15, train back to original rate 
Dec 10 17:02:29 user kernel: [ 8772.064031] QuickDRS: TxTotalCnt <= 15, train back to original rate 

答案1

从您的输出来看,来自网络芯片的调试日志似乎太嘈杂了。不幸的是,除非该模块有一些选项(在 Google 上快速查看显示唯一的选项是在编译时),否则我认为您将无法做您想做的事情。

检查/etc/rsyslog.d/50-default.conf并检查第一行是否有类似内容 *.*;auth,authpriv.none

将其更改为
*.err;auth,authpriv.none

行尾会有一个文件路径。但是,这会停止所有日志记录。您可能不想这样做。

当你需要读取该文件时,你可以这样做

tail /var/log/syslog -n 1000 | grep -v "RT35xx|rt28xx

使用 -v 将仅显示不匹配的行,并且参数是正则表达式,因此您可以得到更复杂的结果。但是看起来该驱动程序很邪恶,开发人员需要严厉惩罚,因为使其过于冗长。

总结一下:

首先尝试降低驱动程序的详细程度。这将是您的最佳选择。
接下来创建某种 grep 语句来过滤掉您不想要的行。
最后,如果其他方法都不起作用,或者您不在乎,请关闭日志记录。

如果您决定关闭日志记录,请注意,您可以更有选择性地关闭内核日志记录。但我并不推荐这样做。

答案2

Ubuntu 论坛 (https://ubuntuforums.org/showthread.php?t=1708767)建议使用下一个命令来禁用无线驱动程序的噪声输出:

iwpriv ra0 set Debug=0

相关内容