はじめに
このドキュメントでは、システムのトレースログを収集および管理するためのシームレスなエクスペリエンスのための新しい統合ロギング拡張機能について説明します。
概要
実用的な目的:
- を参照してください。シャーシで問題が発生すると、トレースファイル内のデータが問題の特定と解決に非常に役立ちます。
- デバッグ.トレースファイルからの出力により、ユーザはシステムのアクションと動作に対してより詳細な視点を得ることができます。
仕組み
- トレース機能は、シャーシ内で発生した内部イベントの詳細を記録します。モジュールの完全なトレース出力を含むトレースファイルが定期的に生成されて更新され、これらのファイルはtracelogディレクトリに保存されます。
- ファイルシステムの空き領域を増やすことができます。トレースファイルは、デバイスのパフォーマンスに影響を与えることなく、このディレクトリから削除できます。
- トレースログを別の場所に転送できます。FTP、TFTPなどを使用して、ファイルをコピーして分析したり、Technical Assistance Center(TAC)でオープンしたケースにファイルをアップロードしたりできます。
- トレースログを無効にすることはできませんが、トレースレベルを変更して、各モジュールに対して収集する情報の量を決定することはできます。
トレース レベル
トレースレベルは、トレースバッファまたはファイルに保持される情報の量を指定します。次は、利用可能なすべてのトレースレベルで、各レベルで記録されるメッセージの種類について説明します。
Emergency—>システムが不安定であるか、使用できない。
Error—>自動解決を行わない場合に、機能がわずかに失われるイベント。操作にすぐには影響しないが、将来的に影響を与える可能性のある、予期しない問題を表します。
警告—>自動的に解決される可能性のある問題、または迅速に調査して対処しないと機能が失われる可能性のある状態。
—>モジュールに設定された標準のログレベルに注意してください。このレベルには、システム内で発生する重要なイベントがキャプチャされます。
Info—>情報メッセージのみ。システムまたはその機能に関連する重要なイベントに関する追加情報を提供します。
Debug—>デバッグログを提供します。
Verbose—>デバッグログの第2レベルを提供します。
Noise—>考えられる最大のメッセージがログに記録されます。
現在のトレースレベルの表示
show platform software trace levelコマンドを使用すると、任意のモジュールのトレースレベルを表示および変更できます。
このコマンドは、アクティブなRPのフォワーディングマネージャプロセスのトレースレベルを表示します。
Router#show platform software trace level forwarding-manager rp active
次に出力を示します。
Module Name Trace Level
-----------------------------------------------
acl Notice
active-identity Notice
alg Notice
appnav-controller Notice
aps Notice
bcrpgc Informational
bfd Notice
bier Notice
トレースレベルの変更
プロセス内の特定のモジュールまたはすべてのモジュールのトレースレベルを変更できます。そのために、set platform software traceコマンドを使用できます。
このコマンドset platform software trace chassis-manager f0 cman_fp warningは、スロット0のESPのシャーシマネージャにおけるcman_fpのトレースレベルを警告レベルに変更します。
この変更は、show platform software trace level chassis-manager f0コマンドで検証できます。
次に出力を示します。
Module Name Trace Level
-----------------------------------------------
bcrpgc Informational
bipc Notice
bsignal Notice
btrace Notice
btrace_ra Notice
cdllib Notice
chasfs Notice
cman_fp Warning
新しいトレースオプション
16,8以降、シスコは統合ロギング機能拡張を導入しています。目標は、IOSロギングとその他のプロセスロギングシステムの間で、ユーザにシームレスなロギングエクスペリエンスを提供することです。両方のシステムのログをマージして時間順に表示できるため、システムの問題のトラブルシューティングが容易になります。
異なるプロセスのトレースログの表示
show logging processコマンドを使用すると、指定したプロセスによって生成されたトレースログの内容を表示できます。bufferおよびtracelogsディレクトリからのログを出力に含めることができます。
部分的なプロセス名もサポートされていますプロセス名は単語として受け入れられますをパーサに渡します。
注:プロセス名はトレースログの名前と(部分的または完全に)一致する必要があります。一致しない場合、不一致が発生してトレースが表示されない可能性があります。
show logging process fman コマンドはfman-rpログとfman-fpログを組み合わせることができます。
Router#show logging process fman
Displaying logs from the last 0 days, 0 hours, 10 minutes, 0 seconds
executing cmd on chassis local ...
Unified Decoder Library Init .. DONE
Found 1 UTF Streams
2024/05/22 19:01:01.347466887 {fman_rp_R0-0}{255}: [source] [11941]: (ERR): ipc(mqipc/iosd/iosd-fman):Unable to open config channel to source
2024/05/22 19:00:50.246774567 {fman_fp_image_F0-0}{255}: [btrace] [13616]: (note): Btrace started for process fman_fp_image_pman ID 13616 with 512 modules
2024/05/22 19:00:50.246777079 {fman_fp_image_F0-0}{255}: [btrace] [13616]: (note): File size max used for rotation of tracelogs: 8192
複数のプロセスサポートの実行
「show logging process」CLIコマンドで、「process」キーワードを使用して複数のプロセス名をカンマで区切って指定できるようになりました。smanおよびios プロセスなど、指定したプロセスのログのみを表示する統合されたtracelog
Router#show logging process sman,ios
executing cmd on chassis 1 ...
Collecting files on current[1] chassis.
タイムウィンドウオプション
ローカルタイムゾーンが設定されている場合、すべてのトレースにローカルタイムゾーンのタイムスタンプを使用できます。そうでない場合、タイムスタンプは「Coordinated Universal Time」(UTC)で使用されますが、set logging timezone <local | UTC>コマンドを使用してログのタイムゾーンをLocalとUTCの間で切り替えることができます。
コマンドshow logging CLIは、デフォルトでは現在の時刻から過去10分間のログのみを表示します。
start lastキーワードを使用すると、個々のニーズに応じて時間帯を拡張できます。
Router#show logging process btman start last ?
<0-4294967295> interval (default seconds)
boot system boot time
clear display all logs since last "clear logging"
marker selects latest matching marker from list to start displaying
logs from
注:前のコマンドの数値を選択した場合は、次のオプションとして日、時間、分、または秒を指定できます。
end lastキーワードオプションが追加されました。このオプションは、start lastと組み合わせて使用して、時間帯の終了を指定します。start lastとend lastの両方のオプションを使用すると、ウィンドウ内のログだけが収集されます。end lastオプションを使用しない場合、ログ収集のデフォルトは終了時間として現在の時間になります。
次の例では、過去2時間から過去1時間の間の時間枠を設定しています。
Router#show logging process btman start last 2 hours end last 1 hours
Displaying logs from the last 0 days, 2 hours, 0 minutes, 0 seconds
End time set to show logs before last 0 days, 1 hours, 0 minutes, 0 seconds
executing cmd on chassis 1 ...
Collecting files on current[1] chassis.
特定のログレベルのログを表示
特定のレベルのログのみを表示できます。
Router#show logging process wncd level ?
debug Debug messages
error Error messages
info Informational messages
notice Notice messages
verbose Verbose debug messages
warning Warning messages
次に、エラーレベルnoticeの下のログbtmanの例を示します。
Router#show logging process btman level notice
Logging display requested on 2024/07/24 06:20:23 (UTC) for Hostname: [Router], Model: [ASR1002-HX ], Version: [17.12.03a], SN: [JAD22460SN9], MD_SN: [FXS2223Q74M]
Displaying logs from the last 0 days, 0 hours, 10 minutes, 0 seconds
executing cmd on chassis local ...
Unified Decoder Library Init .. DONE
Found 1 UTF Streams
2024/07/24 06:10:59.533374335 {btman_R0-0}{255}: [utm_main] [5809]: (note): Inserted UTF(2) HT(old):droputil_R0-0[13] lnode /tmp/rp/trace/droputil_R0-0.6823_63.20240724061059.bin PID:6823
2024/07/24 06:10:59.695395289 {btman_R0-0}{255}: [utm_wq] [5809:15578]: (note): Inline sync, enqueue BTF message flags:0x1, PID:15578 BTF:/tmp/rp/trace/droputil_R0-0.6823_62.20240724060959.bin
タイムスタンプからのログの表示
次のように、UTCの特定のタイムスタンプのログを表示できます。「2017/02/10 14:41:50.849425」
Router#show logging process wncd start timestamp "2024/07/24 05:36:45.849425"
Logging display requested on 2024/07/24 06:39:15 (UTC) for Hostname: [Router], Model: [ASR1002-HX ], Version: [17.12.03a], SN: [JAD22460SN9], MD_SN: [FXS2223Q74M]
executing cmd on chassis local ...
Unified Decoder Library Init .. DONE
Found 1 UTF Streams
Filter policy: Done with UTM processing
2つのタイムスタンプ間のログを表示
start timestampとend timestampを追加することで、タイムウィンドウ間のトレースログを表示できます。これは、1時間のメンテナンスウィンドウの例です。
Router#show logging process wncd start timestamp "2024/07/24 05:36:45.849425" end timestamp "2024/07/24 06:36:45.849425"
Logging display requested on 2024/07/24 06:39:15 (UTC) for Hostname: [Router], Model: [ASR1002-HX ], Version: [17.12.03a], SN: [JAD22460SN9], MD_SN: [FXS2223Q74M]
executing cmd on chassis local ...
Unified Decoder Library Init .. DONE
Found 1 UTF Streams
Filter policy: Done with UTM processing
ライブロギングの実行
プロセスまたはプロファイルに対してリアルタイムで生成されたログを監視できます。ログは生成時に表示されます。
Router#monitor logging process cman ?
<0-25> instance number
filter specify filter for logs
internal select all logs. (Without the internal keyword only customer
curated logs are displayed)
level select logs above specific level
metadata CLI to display metadata for every log message
module select logs for specific modules
ヒント:ライブログモードをエスケープまたは終了するには、CTRL-Cを発行します。
定義済みのログプロファイルを使用する
ライブロギングには、簡単に適用できる組み込みのプロファイルが用意されています。これにより、ユーザーは、この機能を構成する基盤となるプロセス・ログ・ファイルに精通する必要がなくなります。サポートされるプロファイルには、all、file、wireless、sdwan、netconf-yang、restconf、install、hardware-diagnosticsがあります。
このプロファイルはshow loggingまたはmonitor loggingコマンドで使用できます。
注:show logging profileオプションでは、バッファからのログのみが表示され、tracelogsディレクトリからのログは含まれません。
SCP_Test#show logging profile ?
all all processes
file show logs for specific profile file
hardware-diagnostics hardware diagnostics specific processes
install Install specific processes
netconf-yang netconf-yang specific processes
restconf restconf specific processes
sdwan SDWAN specific processes
wireless Wireless specific processes
Router#monitor logging profile ?
all all processes
file show logs for specific profile file
hardware-diagnostics hardware diagnostics specific processes
install Install specific processes
netconf-yang netconf-yang specific processes
restconf restconf specific processes
sdwan SDWAN specific processes
wireless Wireless specific processes
17.12+では、デフォルトで「show logging <process/profile/file> ...」の最後に統計情報が含まれます。 Statsは、各重大度レベルでデコードされたトレースメッセージのうち、既存のデコーダ統計情報に追加されたメッセージの数を示します。レベルカウントは、レンダリングされたトレースに対してのみ行われます。
2024/07/24 04:26:41.710239127 {btman_R0-0}{255}: [utm_wq] [5806:15568]: (note): Inline sync, enqueue BTF message flags:0x1, PID:15568 BTF:/tmp/rp/trace/IOSRP_R0-0.3437_2.20240724042222.bin
2024/07/24 04:26:41.759114843 {btman_R0-0}{255}: [utm_wq] [5806]: (note): utm delete /tmp/rp/trace/IOSRP_R0-0.3437_2.20240724042222.bin
===========================================================
======= Unified Trace Decoder Information/Statistics ======
===========================================================
----------------- Decoder Input Information ---------------
===========================================================
Num of Unique Streams .. 1
Total UTF To Process ... 1
Total UTM To Process ... 89177
UTM Process Filter ..... btman
MRST Filter Rules ...... 1
===========================================================
----------------- Decoder Output Information --------------
===========================================================
First UTM TimeStamp ............... 2024/07/24 02:51:45.623542304
Last UTM TimeStamp ................ 2024/07/24 04:26:48.710794233
UTM [Skipped / Rendered / Total] .. 89047 / 130 / 89177
UTM [ENCODED] ..................... 130
UTM [PLAIN TEXT] .................. 0
UTM [DYN LIB] ..................... 0
UTM [MODULE ID] ................... 0
UTM [TDL TAN] ..................... 0
UTM [APP CONTEXT] ................. 0
UTM [MARKER] ...................... 0
UTM [PCAP] ........................ 0
UTM [LUID NOT FOUND] .............. 0
UTM Level [EMERGENCY / ALERT / CRITICAL / ERROR] .. 0 / 0 / 0 / 0
UTM Level [WARNING / NOTICE / INFO / DEBUG] ....... 0 / 130 / 0 / 0
UTM Level [VERBOSE / NOISE / INVALID] ............. 0 / 0 / 0
===========================================================
ログ出力をファイルに送信
to-fileキーワードを使用すると、show loggingコマンドの出力でファイルを作成できます。次の例は、btmanプロセスのトレースログをbootflashファイルシステムにあるbtman_log.txtという名前のファイルに送信する方法を示しています。
Router#show logging process btman to-file bootflash:btman_log.txt
Logging display requested on 2024/07/25 03:49:41 (UTC) for Hostname: [Router], Model: [ASR1006-X ], Version: [17.09.05a], SN: [FXS221200GH], MD_SN: [FXS2221Q0EL]
Displaying logs from the last 0 days, 0 hours, 10 minutes, 0 seconds
executing cmd on chassis local ...
Files being merged in the background, please check [/bootflash/btman_log.txt] output file
Unified Decoder Library Init .. DONE
unified trace decoder estimates: [1] number of files, [139913] number of messages
that may be processed. Use CTRL+SHIFT+6 to break.
Found 1 UTF Streams
2024-07-25 03:49:41.694987 - unified trace decoder estimate: processed 5%
2024-07-25 03:49:41.701433 - unified trace decoder estimate: processed 10%
2024-07-25 03:49:41.707803 - unified trace decoder estimate: processed 15%
2024-07-25 03:49:41.714185 - unified trace decoder estimate: processed 20%
2024-07-25 03:49:41.720592 - unified trace decoder estimate: processed 25%
2024-07-25 03:49:41.726951 - unified trace decoder estimate: processed 30%
2024-07-25 03:49:41.733306 - unified trace decoder estimate: processed 35%
2024-07-25 03:49:41.739734 - unified trace decoder estimate: processed 40%
2024-07-25 03:49:41.746114 - unified trace decoder estimate: processed 45%
2024-07-25 03:49:41.752462 - unified trace decoder estimate: processed 50%
2024-07-25 03:49:41.758864 - unified trace decoder estimate: processed 55%
2024-07-25 03:49:41.765225 - unified trace decoder estimate: processed 60%
2024-07-25 03:49:41.771582 - unified trace decoder estimate: processed 65%
2024-07-25 03:49:41.777968 - unified trace decoder estimate: processed 70%
2024-07-25 03:49:41.784330 - unified trace decoder estimate: processed 75%
2024-07-25 03:49:41.790693 - unified trace decoder estimate: processed 80%
2024-07-25 03:49:41.797099 - unified trace decoder estimate: processed 85%
2024-07-25 03:49:41.803462 - unified trace decoder estimate: processed 90%
2024-07-25 03:49:41.811411 - unified trace decoder estimate: processed 95%
2024-07-25 03:49:41.822322 - unified trace decoder estimate: processed 100%
2024-07-25 03:49:41.822335 - unified trace decoder : processing complete Result:[Success]
dir bootflashコマンドを使用して、ファイルが作成されたことを確認し、次のようにファイル名をフィルタリングできます。
Router#dir bootflash: | include btman_log.txt
17 -rw- 26939 Jul 25 2024 03:49:41 +00:00 btman_log.txt