[linux] log files & how to see[linux] log files & how to see

Posted at 2012. 9. 16. 13:53 | Posted in OS/Unix/Linux

/var/log/wtmp : 사용자 login & logout & reboot 로그

$ last


/var/log/btmp : 로그인 실패 로그

$ lastb

01.짱깨들이 로그인하려고 돌린 흔적으로 용량이 300MB가 넘었다..
02.-rw------- 1 root utmp 309M Jun 11 11:55 btmp
03. 
04.test     ssh:notty    119.10.114.184   Mon Apr 16 19:37 - 19:37  (00:00)
05.test     ssh:notty    119.10.114.184   Mon Apr 16 19:37 - 19:37  (00:00)
06.oracle   ssh:notty    119.10.114.184   Mon Apr 16 19:37 - 19:37  (00:00)
07.oracle   ssh:notty    119.10.114.184   Mon Apr 16 19:37 - 19:37  (00:00)
08.root     ssh:notty    119.10.114.184   Mon Apr 16 19:37 - 19:37  (00:00)
09.root     ssh:notty    119.10.114.184   Mon Apr 16 19:37 - 19:37  (00:00)
10.root     ssh:notty    119.10.114.184   Mon Apr 16 19:36 - 19:36  (00:00)
11.root     ssh:notty    119.10.114.184   Mon Apr 16 19:36 - 19:36  (00:00)
12.unabv    ssh:notty    119.10.114.184   Mon Apr 16 19:36 - 19:36  (00:00)
13.unabv    ssh:notty    119.10.114.184   Mon Apr 16 19:36 - 19:36  (00:00)
14.rramirez ssh:notty    119.10.114.184   Mon Apr 16 19:36 - 19:36  (00:00)  
15. 
16.$ whois 119.10.114.184
17.[Querying whois.arin.net]
18.[Redirected to whois.apnic.net]
19.[Querying whois.apnic.net]
20.[whois.apnic.net]
21.% [whois.apnic.net node-3]
22.% Whois data copyright terms    http://www.apnic.net/db/dbcopyright.html
23. 
24.inetnum:        119.10.0.0 - 119.10.127.255
25.netname:        XinnetIDC
26.country:        CN
27.descr:          XinNet Technology Corp.
28.descr:          1st Floor, 2nd Building Section A,
29.descr:          BDA BeiGongDa Soft-ware Area, Beijing China.  <-- 중국애들 맞네..


파일 비우기(clear btmp)

cat /dev/null > /var/log/btmp


/var/log/messages : 시스템 에러 및 하드웨어 에러 로그

$ vi messages


/var/log/secure : 사용자 인증관련 로그

$ vi secure


/var/log/lastlog : 사용자 최종 로그인 정보

$ lastlog


현재 접속자 정보 보기

$ w

$ who

//