소개
이 문서에서는 시스템의 Tracelogs를 수집 및 관리할 수 있는 원활한 환경을 위한 새로운 통합 로깅 개선 사항에 대해 설명합니다.
개요
실용적인 목적:
- 문제 해결. 섀시에 문제가 발생할 경우 추적 파일의 데이터는 문제를 식별하고 해결하는 데 매우 유용할 수 있습니다.
- 디버깅. 추적 파일의 출력은 시스템의 작업 및 작업에 대한 좀 더 세부적인 관점을 사용자에게 제공할 수 있습니다.
작동 방식
- 추적 기능은 섀시 내에서 발생하는 내부 이벤트의 세부사항을 기록합니다. 모듈에 대한 전체 추적 출력이 포함된 추적 파일이 정기적으로 생성되고 새로 고쳐지며 이러한 파일은 tracelog 디렉토리에 보관됩니다.
- 파일 시스템의 공간을 확보할 수 있습니다. 디바이스의 성능에 영향을 주지 않고 이 디렉토리에서 추적 파일을 삭제할 수 있습니다.
- 추적 로그를 대체 위치로 전송할 수 있습니다. FTP, TFTP 등을 사용하여 파일을 복사하여 분석하거나 TAC(Technical Assistance Center)에서 연 케이스에 업로드할 수 있습니다.
- 추적 로그는 비활성화할 수 없지만 추적 수준을 변경하여 각 모듈에 대해 수집할 정보의 양을 결정할 수 있습니다.
추적 수준
추적 레벨은 추적 버퍼 또는 파일에 보존되는 정보의 볼륨을 나타냅니다. 사용 가능한 모든 추적 레벨이 그 다음이며 각 레벨에서 로깅되는 메시지의 종류를 설명합니다.
Emergency—> 시스템이 불안정하거나 사용할 수 없습니다.
오류—> 자동 해결 없이 약간의 기능 손실이 발생하는 이벤트로, 작업에 즉시 영향을 미칠 수 없지만 향후 결과가 발생할 수 있는 예기치 않은 문제를 나타냅니다.
경고—> 잠재적으로 자동으로 해결될 수 있는 문제이거나, 즉시 조사 및 해결되지 않을 경우 기능이 손실될 수 있는 조건입니다.
모듈에 대해 설정된 표준 로그 레벨을 확인합니다—>. 이 레벨은 시스템 내에서 발생하는 중요한 이벤트를 캡처합니다.
정보—> 정보 메시지만 표시됩니다. 시스템 또는 해당 기능과 관련된 중요한 이벤트에 대한 추가 정보를 제공합니다.
Debug—> 디버깅 로그를 제공합니다.
Verbose—> 두 번째 수준의 디버깅 로그를 제공합니다.
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
추적 수준 수정
프로세스의 특정 모듈 또는 모든 모듈에 대한 추적 레벨을 수정할 수 있습니다. 이를 위해 명령 세트 플랫폼 소프트웨어 추적을 사용할 수 있습니다.
이 명령 세트 플랫폼 소프트웨어 추적 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부터 Cisco는 Unified Logging 개선 사항을 소개합니다. 목표는 IOS 로깅 및 기타 프로세스 로깅 시스템 간에 사용자를 위한 원활한 로깅 환경을 만드는 것입니다. 두 시스템의 로그를 시간순으로 병합하여 표시할 수 있으므로 시스템 문제를 쉽게 해결할 수 있습니다.
다른 프로세스에 대한 추적 로그 표시
명령 show logging 프로세스를 사용하여 지정된 프로세스에 의해 생성된 tracelogs의 내용을 표시할 수 있습니다. 버퍼 및 tracelogs 디렉토리의 로그를 출력에 포함할 수 있습니다.
프로세스 이름이 단어로 사용되는 부분 프로세스 이름도 지원됩니다제공합니다.
참고: 프로세스 이름은 tracelog의 이름과 (부분적으로 또는 완전히) 일치해야 합니다. 그렇지 않으면 불일치가 발생하여 추적이 표시되지 않을 수 있습니다.
명령 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 프로세스)의 로그만 표시하는 병합된 추적로그입니다.
Router#show logging process sman,ios
executing cmd on chassis 1 ...
Collecting files on current[1] chassis.
시간 창 옵션
구성된 경우 모든 추적에 로컬 시간대의 타임스탬프가 있을 수 있습니다. 그렇지 않은 경우 타임스탬프는 "UTC(Coordinated Universal Time)"에서 사용되지만 logging timezone <local set 명령을 사용하여 Local과 UTC 간의 로그 표준 시간대를 전환할 수 있습니다 | 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
다음은 오류 레벨 알림에 있는 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
타임스탬프의 로그 표시
"2017/02/10 14:41:50.849425"과 같이 특정 타임스탬프의 로그를 UTC로 표시할 수 있습니다. 예를 들면 다음과 같습니다.
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
두 타임스탬프 간 로그 표시
시작 타임스탬프와 종료 타임스탬프를 추가하여 시간 창 간에 추적을 표시할 수 있습니다. 다음은 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 명령의 출력으로 파일을 만들 수 있습니다. 다음 예에서는 bootflash 파일 시스템의 btman_log.txt라는 파일로 프로세스 btman의 추적 로그를 전송하는 방법을 보여줍니다.
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