강좌
클라우드/리눅스에 관한 강좌입니다.
리눅스 분류

logwach (로그정리 후 메일 발송 )

작성자 정보

  • 웹관리자 작성
  • 작성일

컨텐츠 정보

본문

icon01.giftitle06.gif

######################################################################
        logwatch-3.3-2 버전업
######################################################################

logwatch 는 해당 로그 파일을 하루 단위로 종합적으로 정리를 해서 메일로 보내주는 데몬입니다..
로그로 기록이 되는 것은 다시 보기 좋게 재 가공을 해서 다음날 비교적 편하게 서버의 하루 로그를 볼수 있습니다..
로그에 민감하시거나 편한 로그 관리를 찾으셨다면 추천해 드립니다..

다운 :
http://www.logwatch.org 에서 logwatch-3.3-2.noarch.rpm 다운

[root@cardsarang chtla]# rpm -Uvh logwatch-3.3-2.noarch.rpm
Preparing...                ########################################### [100%]
   1:logwatch               ########################################### [100%]

/etc/log.d/conf/logwatch.conf <== 설정 파일
/etc/log.d/scripts/logwatch.pl <== 크론에 의해 실행되는 파일(하루 한번)
/etc/log.d/conf/services          <== 기록될 해당 서비스들을 각 설정을 세팅할수 있다.. 디폴트로 사용하는 것도 무난..
(tar 등으로 설치된 것들은 해당 데몬이나 경로가 틀려서 못 찾을수도 있으니 제대로 보여지지 않을 경우 해당 파일 수정하면 된다.)

현재 지원되는 서비스는
arpwatch, automount, cron, dhcpd, exim, ftpd-messages, ftpd-xferlog, inentd, init, kernel, named, samba, sshd, sshd2 등

[root@chtla conf]# vi logwatch.conf

LogDir = /var/log  <== 해당 로그 디렉토리
MailTo = root        <== 메일을 발송한 유저

설치후 우선 확인해 보아야 할것은 이 두군데..

설치후 달리 해 줄것이 없이 그냥 두면.. 크론에 의해 새벽 4시쯤에 로그 기록을 정리해 메일로 발송하게 된다..

[root@chtla scripts]# cd /etc/cron.daily/
[root@chtla cron.daily]# l
합계 9
lrwxrwxrwx    1 root     root           28  7월 15 16:57 00-logwatch -> ../log.d/scripts/logwatch.pl*


메일로 발송되는 메일을 잠시 살펴 보면..

################## LogWatch 3.3 Begin #####################

--------------------- ModProbe Begin ------------------------

Can't locate these modules: <== 현재 사운드쪽 모듈에 에러가..ㅡ.ㅡ;;
   sound-slot-1: 2 Time(s)
   sound-service-1-0: 2 Time(s)
   char-major-81: 1 Time(s)
   sound-service-0-0: 1 Time(s)


---------------------- ModProbe End -------------------------



--------------------- Named Begin ------------------------  <== zone파일의 로드된 횟수를 보여주고 있다..

**Unmatched Entries**
   zone 0.0.127.in-addr.arpa/IN: loaded serial 1997022700: 1 Time(s)
   zone xx.xx.12.in-addr.arpa/IN: loaded serial 207151815: 1 Time(s)
   zone aaa.co.kr/IN: loaded serial 207151842: 1 Time(s)
   zone bbb.com/IN: loaded serial 207131449: 1 Time(s)
   zone localhost/IN: loaded serial 42: 1 Time(s)


---------------------- Named End -------------------------



--------------------- pam_unix Begin ------------------------  <== 로그인에 관련된 로그.. 루트로 접속 실패가 없었네요..(콘솔상에서^^)
login:
   Unknown Entries:
      session opened for user root by LOGIN(uid=0): 1 Time(s)
   Authentication Failures:
      root ( ): 1 Time(s)


--------------------- pam_unix End --------------------------



---------------------- PortSentry Begin -------------------------


Warning: Portscans detected <== iptable에 의해 거버된 아이피와 횟수
   TCP SYN/Normal from:
      211.114.xx.xx: ports: 111
      c188.h061016073.is.net.tw (61.16.xx.xx): ports: 111

Warning: Blocked route from/to c188.h061016073.is.net.tw (61.16.xx.xx) 1 times(s).
Warning: Blocked route from/to 211.114.xx.xx 1 times(s).


---------------------- PortSentry End -------------------------



--------------------- proftpd-messages Begin ------------------------ <== 두곳에서 anonymous로 ftp 접속 시도

**Unmatched Entries**
chtla (64.83.xx.xx[64.83.xx.xx]) - mod_sql/4.09: warning: no SQLConnectInfo specified. mod_sql is OFF
chtla (64.83.xx.xx[64.83.xx.xx]) - no such user 'anonymous'
chtla (68.11.xx.xx[68.11.xx.xx]) - mod_sql/4.09: warning: no SQLConnectInfo specified. mod_sql is OFF
chtla (68.11.xx.xx[68.11.xx.xx]) - no such user 'anonymous'


---------------------- proftpd-messages End -------------------------



---------------- Connections (secure-log) Begin -------------------

Connections:
   Service sshd2:
      ion: 1 Time(s)
   Service ftp:         <==== 해당 아이피에서 ftp로 서버 접속..
      64.83.xx.xx: 1 Time(s)
      68.11.xx.xx: 1 Time(s)
   Service pop3:      <==== 해당 아이피에서 pop3 로 접속(각 아이피별 접속 횟수를 보임)
      61.81.xx.xx: 1 Time(s)
      218.140.xx.xx: 22 Time(s)

**Unmatched Entries** <== 매치가 되지않는 엔트리라.. 뭐라고 해야 하나..
sshd2[891]: Listener created on port 22.
sshd2[897]: Daemon is running.
proftpd[17027]: chtla (64.83.xx.xx[64.83.xx.xx]) - USER anonymous: no such user found from 64.83.xx.xx [64.83.xx.xx] to 211.xx.xx.xx:21
proftpd[17028]: chtla (68.11.xx.xx[68.11.xx.xx]) - USER anonymous: no such user found from 68.11.108.72 [68.11.108.72] to 211.xx.xx.xx:21
sshd2[25575]: User OOO's local password accepted.
sshd2[25575]: Password authentication for user OOO accepted.
sshd2[25575]: User OOO, coming from 211.xx.xx.xx, authenticated.
sshd2[25575]: Local disconnected: Connection closed.
sshd2[25575]: connection lost: 'Connection closed.'


----------------- Connections (secure-log) End --------------------



--------------------- sendmail Begin ------------------------

61490 bytes transferred <== 전체 보내진 메일의 용량
17 messages sent <=== 전체 메세지의 수..

Relaying denied:   <== 수신 거부된 아이피와 횟수..
    From [209.194.xx.xx] to
jamara@dharma.zzn.com: 1 Times(s)
    From [209.196.xx.xx] to
katrina@ifrance.com: 1 Times(s)

---------------------- sendmail End -------------------------


--------------------- up2date Begin ------------------------

**Unmatched Entries**
new up2date run started
new up2date run started
new up2date run started
new up2date run started
new up2date run started
new up2date run started
new up2date run started


---------------------- up2date End -------------------------



------------------ Fortune -------------------- <== 3.x 대에서는 하루에 한다미씩 좋은 글도 읽을수 있답니다..^^

> No manual is ever necessary.
May I politely interject here: BULLSHIT.  That's the biggest Apple lie of all!
(Discussion in comp.os.linux.misc on the intuitiveness of interfaces.)



###################### LogWatch End #########################


해당 시간대등은 나타나지 않지만, 이것은 기록을 간단해 두었기 때문이다..
더 상세히 기록이 가능한것으로 알고 있다..(conf 파일을 살펴 보면..)

해당 기록중 이상하다고 생각되거나 의심가는 로그는 세부 로그 파일를 다시 살펴 보아야 한다..

Created by KAN and MISO Return to Original Intention.. / chtla.com ( Site Version 1.0 )

관련자료

댓글 0
등록된 댓글이 없습니다.

공지사항


뉴스광장


  • 현재 회원수 :  60,034 명
  • 현재 강좌수 :  35,787 개
  • 현재 접속자 :  291 명