方法一:在用戶界麵視圖下關閉命令行記錄(推薦)
<Device> system-view
[Device] user-interface console 0 # 控製台口
[Device-ui-console0] undo info-center enable
[Device-ui-console0] quit
[Device] user-interface vty 0 4 # 虛擬終端(SSH/Telnet)
[Device-ui-vty0-4] undo info-center enable
[Device-ui-vty0-4] quit
方法二:調整日誌級別(更精細控製)
# 設置指定模塊的日誌級別,隻記錄更高級別的日誌
[Device] info-center source default channel logbuffer log level warning
# 或更嚴格的級別
[Device] info-center source default channel logbuffer log level error
方法三:針對SHELL模塊單獨設置
# 調整SHELL模塊的日誌級別(display命令屬於SHELL模塊)
[Device] info-center source shell channel logbuffer log level error
# 或者直接關閉SHELL模塊的日誌
[Device] info-center source shell channel logbuffer debug state off
方法四:配置日誌過濾策略
# 創建日誌過濾策略
[Device] info-center filter
[Device-filter] filter bymodule shell deny
[Device-filter] quit
方法五:在特定VTY線路下配置
# 僅為特定用戶線路關閉日誌記錄
[Device] user-interface vty 0
[Device-ui-vty0] set commands logging
# 或者更嚴格的控製
[Device-ui-vty0] info-center loghost suppress
方法六:調整info-center全局參數
# 調整日誌緩衝區大小和記錄頻率
[Device] info-center logbuffer size 512
[Device] info-center source default log level warning
建議的解決方案組合
對於您的需求,最直接有效的方法是:
<Device> system-view
[Device] user-interface vty 0 4
[Device-ui-vty0-4] undo info-center enable
[Device-ui-vty0-4] quit
[Device] info-center source shell channel logbuffer log level error
[Device] quit
<Device> save
注意事項
安全考慮:關閉操作日誌會降低審計能力,建議在測試或維護期間臨時使用
影響範圍:上述設置隻會影響當前設備,不會影響iMC EIA服務器的日誌記錄
版本差異:不同版本命令可能略有差異,使用前可用?查看幫助
恢複方法:需要時可將undo改為info-center enable重新開啟
驗證配置
配置後,查看是否生效:
<Device> display logbuffer
# 觀察是否還有display命令記錄
<Device> display info-center
# 查看當前日誌配置
推薦方案:在生產環境中,建議使用方法二,將日誌級別調整為warning,這樣既能過濾掉大部分display等普通操作日誌,又能保留重要的告警和錯誤信息,兼顧了可維護性和日誌可讀性。
通過以下方式在交換機上屏蔽
display 命令產生的操作日誌(如 SHELL/6/SHELL_CMD):
操作步驟(適用於H3C V7平台交換機)
2. 屏蔽特定日誌類型
執行以下命令,屏蔽助記符為 SHELL_CMD 的操作日誌:
info-center logging suppress module SHELL mnemonic SHELL_CMD
module SHELL:指定日誌來源模塊為 SHELL(即命令行操作日誌)。
mnemonic SHELL_CMD:指定助記符為 SHELL_CMD(對應
display 等命令的操作記錄)。
效果說明
執行後:
所有通過命令行執行的 display 等操作(原日誌類型為 SHELL_CMD)將不再記錄到日誌緩衝區(logbuffer)。
不影響其他日誌:
其他模塊的日誌(如接口狀態變化、係統告警等)仍會正常記錄。
📌 注意
此配置需在係統視圖下完成。
配置僅對新建立的終端會話生效。若當前會話已存在日誌,需重新登錄終端才會停止記錄。
若需恢複記錄,使用命令 undo info-center logging suppress module SHELL mnemonic SHELL_CMD。
技術依據
日誌結構解析(來自文檔):
%TIMESTAMP HOSTNAME %%模塊名/日誌級別/助記符: 詳細內容
示例:%Jul 20 13:01:20:615 2022 Sysname
SHELL/6/SHELL_CMD: -Line=con0-IPAddr=-User=; Command is display logbuffer
模塊名:SHELL(命令行操作)
助記符:SHELL_CMD(記錄用戶執行的命令)
通過抑製指定模塊的助記符,可精準過濾日誌(參考「重複日誌抑製功能」部分案例)。
補充說明
適用場景:
需減少日誌緩衝區幹擾時(如頻繁執行 display 命令導致日誌刷屏)。
替代方案:
若需完全關閉 SHELL 模塊的所有日誌,可使用:
info-center source SHELL logbuffer off
但此操作會同時屏蔽其他 SHELL 相關日誌(如登錄記錄),請謹慎使用。
暫無評論
親~登錄後才可以操作哦!
確定你的郵箱還未認證,請認證郵箱或綁定手機後進行當前操作
舉報
×
侵犯我的權益
×
侵犯了我企業的權益
×
抄襲了我的內容
×
原文鏈接或出處
誹謗我
×
對根叔社區有害的內容
×
不規範轉載
×
舉報說明
暫無評論