CentOS 7.x logwatch 로그분석 알림 유틸



리눅스의 로그를 분석해서 에러정보나 ssh 접속시도와 같은 정보를 매일 오전에 메일로 보내주는 유틸입니다.


하드디스크 용량 정보도 있어서 유용하다면 유용하고 메일을 하루에 한통씩을 받아야 하는 어쩌면 귀찮기도 합니다.


설치는 방법은 아래와 같습니다.


# yum install logwatch


설정은 크게 바꿀건 없고 메일 주소만 변경해주면 됩니다.


# vi /usr/share/logwatch/default.conf/logwatch.conf

MailTo = root


root 대신에 실제 메일주소를 입력하면 됩니다.


/etc/cron.daily 크론에 등록이 되어 있어서 매일 하루에 한번씩 실행이 됩니다.


강제로 실행하는 방법은 아래 처럼 하면 됩니다.


# /usr/sbin/logwatch --output mail


위의 명령어를 실행하면 메일로 아래 처럼 리포트 메일이 날아옵니다.


################### Logwatch 7.4.0 (03/01/11) #################### 

        Processing Initiated: Fri Mar 24 16:27:20 2017

        Date Range Processed: yesterday

                              ( 2017-Mar-23 )

                              Period is day.

        Detail Level of Output: 0

        Type of Output/Format: mail / text

        Logfiles for Host: conoha.ivps.kr

 ################################################################## 

 

 --------------------- httpd Begin ------------------------ 


 Connection attempts using mod_proxy:

    1.162.172.194 -> mx-tw.mail.gm0.yahoodns.net:25: 231 Time(s)

    195.154.226.17 -> lqak.euw1.lol.riotgames.com:443: 3 Time(s)

 

 A total of 3 sites probed the server 

    183.129.160.229

    60.191.38.77

    60.191.38.78

 

 Requests with error response codes

    400 Bad Request

       lqak.euw1.lol.riotgames.com:443: 3 Time(s)

    404 Not Found

       /favicon.ico: 14 Time(s)

       /robots.txt: 8 Time(s)

       /current_config/passwd: 4 Time(s)

       /current_config/Account1: 3 Time(s)

       /admin/i18n/readme.txt: 2 Time(s)

       /auto/4_0235.html: 1 Time(s)

       /auto/8_6858.html: 1 Time(s)

       /cgi-bin/php?-d+allow_url_include%3Don+-d+ ... atus_env%3D0+-n: 1 Time(s)

       /hot/news/0_3783.html: 1 Time(s)

       /html/5_8085.html: 1 Time(s)

       /html/7_7733.html: 1 Time(s)

       /media/7_4339.html: 1 Time(s)

       /phpmyadmin: 1 Time(s)

       /pic/news/5_4026.html: 1 Time(s)

       /shehui/6_1375.html: 1 Time(s)

       /tech/4_7891.html: 1 Time(s)

       /yule/1_6028.html: 1 Time(s)

    405 Method Not Allowed

       /webdav/: 3 Time(s)

 

 ---------------------- httpd End ------------------------- 


 

 --------------------- pam_unix Begin ------------------------ 


 sshd:

    Authentication Failures:

 

 vsftpd:

    Authentication Failures:

       unknown (202.107.219.49): 1 Time(s)

       unknown (39.33.123.228): 1 Time(s)

    Invalid Users:

       Unknown Account: 2 Time(s)

 

 

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


 

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


 

 **Unmatched Entries**

 

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


 

 --------------------- SSHD Begin ------------------------ 


 

 SSHD Killed: 2 Time(s)

 

 SSHD Started: 4 Time(s)

 

 Failed logins from:

 

 Illegal users from:

    undef: 1 time

 

 Login attempted when not in AllowUsers list:

 

 Users logging in through sshd:

 

 

 Received disconnect:

    11: disconnected by user : 17 Time(s)

 

 **Unmatched Entries**

 error: key_from_blob: can't read key type : 2 time(s)

 error: buffer_get_string_ret: bad string length 67108871 : 2 time(s)

 

 ---------------------- SSHD End ------------------------- 


 

 --------------------- Disk Space Begin ------------------------ 


 Filesystem      Size  Used Avail Use% Mounted on

 /dev/vda2        20G   15G  4.4G  77% /

 devtmpfs        236M     0  236M   0% /dev

 

 

 ---------------------- Disk Space End ------------------------- 


 

 ###################### Logwatch End ######################### 


조금 가공한 로그입니다.


블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,