Skip to content

Commit

Permalink
아파치 에러 로그 분석 스크립트
Browse files Browse the repository at this point in the history
  • Loading branch information
sohwaje committed May 19, 2019
1 parent 402087d commit 556cc9a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions apache_errorlog.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3.7

# Grap a IP, PATH and URL in Apache Access_log
# 아파치 에러로그의 특정 에러 메시지가 포함된 문자열을 IP와 URL 또는 Path로 구분하여 출력한다.
"""usage
]> python3.7 script_name apache_error.log
"""
Expand All @@ -15,15 +15,15 @@
ERROR_LOG = open(file_name, 'r')

"""
정규식 컴파일
찾을 문자열 패턴을 컴파일
"""
def regular_expression_compile():
p = '(?:[\d]+[.]\d+[.]\d+[.][\d]+)|(?:\s\/.*?\s)|http[s]?://(?:[a-zA-Z0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+'
target_expression = re.compile(p)
return target_expression

"""
FILE_DOES_NOT_EXIST 로그 찾기
[1]FILE_DOES_NOT_EXIST 로그 찾기
"""
def FILE_DOES_NOT_EXIST():
num = 0
Expand All @@ -38,7 +38,7 @@ def FILE_DOES_NOT_EXIST():
pass

"""
CLIENT_DENIED_BY_SERVER_CONFIGURATION 로그 찾기
[2]CLIENT_DENIED_BY_SERVER_CONFIGURATION 로그 찾기
"""
def CLIENT_DENIED_BY_SERVER_CONFIGURATION():
num = 0
Expand All @@ -53,15 +53,15 @@ def CLIENT_DENIED_BY_SERVER_CONFIGURATION():


"""
스크립트 종료 함수
스크립트 종료
"""
def End_of_script(x):
print(x, "Good Bye")
ERROR_LOG.close()
exit(0)

"""
스크립트 시작 함수 : 다자택일
스크립트 시작
"""
def start():
print("FILE_DOES_NOT_EXIST : 1")
Expand Down

0 comments on commit 556cc9a

Please sign in to comment.