Log
imRAD 장비에서 발생한 로그들은 show log 명령어를 통해 확인 할 수 있으며 키워드(keyword)를 사용한 선택 출력 및 -w 옵션을 이용해 로그를 실시간으로 표시 할 수 있습니다.
LYSH@MyHostName# show log {name} [-h] [-n NUMBER] [-w] [keyword]
optional arguments:
-h, --help show this help message and exit
-n [NUMBER], --number [NUMBER] enter 0 to show all logs, and enter a value greater than 0 to show as much as the value entered
-w, --watch show the log or setup status in real time
아래 테이블은 모든 종류의 로그를 나타내며 몇몇 로그는 서비스 동작 중 실시간으로 생성되는 런타임 로그( Runtime log)입니다. 런타임 로그는 비활성 상태로 설정되어 있으면 로그가 생성되지 않으니 로그를 저장하려면 상태를 활성으로 변경하세요. 각 서비스에 대한 런타임 로그 상태는 show service 명령어로 확인 할 수 있습니다.
| 로그 이름 | 설명 |
|---|---|
| apache2 | apache2 access 로그입니다. |
| dhcpv4 | dhcpv4 서비스의 런타임 로그입니다. |
| dhcpv6 | dhcpv6 서비스의 런타임 로그입니다. |
| failover | failover 서비스의 런타임 로그입니다.. |
| logexp | logexp 서비스의 런타임 로그입니다. |
| lsyslog | imRAD 서비스에 발생한 syslog 입니다. |
| mysqlerror | MySQL error 로그입니다. |
| mysqlslow | MySQL slow 로그입니다. |
| radius | radiusd 서비스의 런타임 로그입니다. |
| smgr | smgr 서비스의 런타임 로그입니다. |
| startup | startup 서비스의 런타임 로그입니다. |
| syslog | Syslog 입니다. |
| ufw | ufw(방화벽)에 의해 차단된 로그입니다. |
| update | 시스템 업데이트 로그입니다. |
로그 출력
LYSH@MyHostName# show log apache2 // Display all apache2 logs LYSH@MyHostName# show log radius // Display all radius logs
n개의 로그 출력
LYSH@MyHostName# show log apache2 -n 10 // Display only the last 10 apache2 logs LYSH@MyHostName# show log radius -n 10 // Display only the last 10 radius logs
키워드를 포함한 n개의 로그 출력
LYSH@MyHostName# show log apache2 -n 10 request // Display only the last 10 apache2 logs filtered by "request" LYSH@MyHostName# show log radius -n 10 accept // Display only the last 10 radius logs filtered by "request"
실시간 로그 출력
LYSH@MyHostName# show log apache2 -w // Display the apache2 logs in real-time LYSH@MyHostName# show log radius -w // Display the radius logs in real-time
키워드를 포함한 로그를 실시간 출력
LYSH@MyHostName# show log apache2 -w request // Display the apache2 logs filtered by "request" in real-time LYSH@MyHostName# show log radius -w accept // Display the radius logs filtered by "accept" in real-time
연산자를 이용한 키워드 조합
2개 이상의 키워드를 이용해 로그를 검색하려면 &나 | 연산자를 사용해 검색 할 수 있습니다.
LYSH@MyHostName# show log "request&reply" // Display the apache2 logs having both "request" and "reply" LYSH@MyHostName# show log "request|reply" // Display the apache2 logs having either "request" or "reply"
키워드를 입력 할때는 큰따옴표를 사용하세요.
로그 파일 출력
show log files 명령어를 이용해 저장되어 있는 모든 로그를 출력 할 수 있으며 디스크 용량 확인 시 이용 할 수 있습니다. 디스크 용량이 적은 경우 로그 파일을 확인 후 system storage cleanup 명령어를 사용해 백업된 로그를 삭제하여 디스크 용량을 확보 할 수 있습니다.
LYSH@MyHostName# show log files 0 2021-05-12 13:57 LOG/apache2/other_vhosts_access.log 0 2021-05-12 13:57 LOG/btmp 4.0K 2021-05-10 18:06 LOG/installer 4.0K 2021-05-10 18:23 LOG/private ... 289M 2021-05-12 14:40 LOG/journal/dca4ac54531c48e2ad4e199728e9e888 344M 2021-05-12 14:42 LOG
Configuration
loghost
imRAD 장비의 로그를 원격 syslog 서버로 전송 할 수 있는 기능을 의미합니다. 단, 런타임 로그는 전송되지 않습니다.
LYSH@MyHostName# configure configure# loghost add -h usage: loghost add [-h] <A.B.C.D|WORD> [<[1-65535]>] [<[WORD]>]
예로 모든 로그를 192.168.0.100 syslog 서버에 전송하려면 다음과 같이 입력하면됩니다.
configure# loghost add 192.168.0.100
예로 모든 로그를 1000번 포트를 사용하는 192.168.0.100 syslog 서버에 전송하려면 다음과 같이 입력하면됩니다.
configure# loghost add 192.168.0.100 1000
로그중 "notice" 이상만 전송하려면 아래 예제와 같이 입력하면 됩니다.
configure# loghost add 192.168.0.100 1000 notice
설정된 loghost는 show loghost 명령어를 이용하세요.
LYSH@MyHostName# show loghost *.notice @192.168.0.100:1000
rotate
logroate[1]를 통해 로그 파일을 자동으로 압축, 백업 그리고 삭제 할 수 있습니다. configuration mode에서 log roate {size} {roate} 명령어를 사용해 최채 파일 크기 및 보유 개수를 정의할 수 있습니다.
- size: 로그 파일이 특정 크기가 되면 자동으로 rotating 되며 그 크기는 kilobytes (sizeK), megabytes (sizeM), 또는 gigabytes (sizeG)로 정의 할 수 있습니다.
- rotate: rotating후 보유할 최대 파일 개수를 의미합니다. 만일 값이 5라면 5개의 백업 파일을 시스템에 보유하고 나머진 삭제합니다.[2]
설정 확인은 show system rotate 명령어로 이용하세요.
LYSH@MyHostName# configure configure# log roate 1G 3 configure# exit LYSH@MyHostName# show system rotate log rotate : size:1G rotate:3
sort
You can specify the order of logs display. This configuration affects when if you execute the show log command without -w option. you can verify current setting by executing show system logsort. If the sort is "desc," it shows logs in descending order. If the sort is "asc", it shows logs in ascending order.
LYSH@MyHostName# show system logsort logsort : desc // logs are shown in descending order.
You can change the order in the configuration mode.
LYSH@MyHostName# configure configure# log sort asc configure# exit LYSH@MyHostName# show system logsort logsort : asc // logs are shown in descending order.