Linux/명령어 (command)

로그를 보는법 (log)

이주성 2017. 12. 11. 11:15

tail 명렁어로 log를 보는법

scp로 접속을 하는데, 계속 permission 에러가 발생한다. 도대체 왜 그럴까? 이럴때는 가장 기본적인 것이 시스템 로그를 보는 것이다.
/var/log 폴더를 보면, 여러가지 log파일들이 있다. ssh permission 에러면 auth.log를 보면 된다. tail -f 명렁어를 쓰면 실시간으로 확인가능 하다.

pi@raspberrypi:/var/log $ cd /var/log

pi@raspberrypi:/var/log $ ls

Xorg.0.log        auth.log       daemon.log  fontconfig.log  messages  wtmp

Xorg.0.log.old    boot.log       debug       kern.log        samba

alternatives.log  bootstrap.log  dpkg.log    lastlog         syslog

apt               btmp           faillog     lightdm         user.log

pi@raspberrypi:/var/log $ tail -f auth.log 

Dec 11 11:08:22 raspberrypi sshd[2841]: Server listening on 0.0.0.0 port 22.

Dec 11 11:08:22 raspberrypi sshd[2841]: Server listening on :: port 22.

Dec 11 11:08:22 raspberrypi sudo: pam_unix(sudo:session): session closed for user root

Dec 11 11:08:27 raspberrypi sshd[2845]: Accepted password for pi from 124.66.181.145 port 43777 ssh2

Dec 11 11:08:27 raspberrypi sshd[2845]: pam_unix(sshd:session): session opened for user pi by (uid=0)

Dec 11 11:08:27 raspberrypi systemd-logind[332]: New session c10 of user pi.

Dec 11 11:08:28 raspberrypi sshd[2856]: Received disconnect from 124.66.181.145 port 43777:11: disconnected by user

Dec 11 11:08:28 raspberrypi sshd[2856]: Disconnected from 124.66.181.145 port 43777

Dec 11 11:08:28 raspberrypi sshd[2845]: pam_unix(sshd:session): session closed for user pi

Dec 11 11:08:28 raspberrypi systemd-logind[332]: Removed session c10.