가동중인 서버 로그 확인

뚜우웅이·2025년 5월 20일

캡스톤 디자인

목록 보기
24/35

로그 파일 찾기

로그 파일 찾기

# 최근에 수정된 로그 파일 찾기
find /home/ubuntu -name "*.log" -type f -mtime -1 | xargs ls -lt | head

# 또는 더 넓은 범위에서 검색
find / -name "*.log" -type f -mtime -1 2>/dev/null | xargs ls -lt | head

# 애플리케이션 이름이 포함된 로그 파일 찾기
find /home/ubuntu -name "*freemarket*.log" -type f
find /var/log -name "*freemarket*.log" -type f

/home/ubuntu/app.log에 저장되어 있었다.

로그 보기

# 가장 최근 로그 내용 확인
tail -n 100 /home/ubuntu/app.log

# 또는 오류 메시지만 필터링하여 확인
grep ERROR /home/ubuntu/app.log

# 또는 가장 최근 오류 메시지 확인
tail -n 500 /home/ubuntu/app.log | grep -A 20 ERROR

# 실시간으로 로그 모니터링
tail -f /home/ubuntu/app.log

# 더 많은 줄을 보기
tail -n 500 /home/ubuntu/app.log | head -n 100

# 또는 오류 메시지 찾기
grep -A 20 -B 10 "ERROR" /home/ubuntu/app.log | tail -n 100

# 특정 키워드로 찾기
grep -A 20 -B 10 "Exception" /home/ubuntu/app.log | tail -n 100
profile
공부하는 초보 개발자

0개의 댓글