forked from windschord/WOWHoneypot2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logging_conf.py
119 lines (119 loc) · 3.62 KB
/
logging_conf.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
conf = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'isAccessLog': {
'()': 'utils.CustomLogFilter.AccessLogFilter'
},
'isHuntLog': {
'()': 'utils.CustomLogFilter.HuntLogFilter'
},
'isHuntResultLog': {
'()': 'utils.CustomLogFilter.HuntResultLogFilter'
},
},
# 'loggers': {
# 'elasticsearch': {
# 'level': 'INFO',
# 'handlers': [
# 'consoleHandler',
# 'logFileHandler',
# ],
# "propagate": "no",
# }
# },
'root': {
'level': 'DEBUG',
'handlers': [
'consoleHandler',
'logFileHandler',
'AccessLogFileHandler',
# 'AccessLogSysLogHandler',
'HuntLogFileHandler',
'HuntResultLogFileHandler',
]
},
'handlers': {
'consoleHandler': {
'class': 'logging.StreamHandler',
'level': 'INFO',
'formatter': 'consoleFormatter',
'stream': 'ext://sys.stdout'
},
'logFileHandler': {
'class': 'logging.handlers.TimedRotatingFileHandler',
'level': 'DEBUG',
'formatter': 'logFileFormatter',
'filename': './log/wowhoneypot.log',
'when': 'MIDNIGHT',
'backupCount': 10,
'encoding': 'utf-8'
},
'AccessLogFileHandler': {
'class': 'logging.handlers.TimedRotatingFileHandler',
'level': 'INFO',
'formatter': 'AccessLogFileFormatter',
'filename': './log/access.log',
'when': 'MIDNIGHT',
'backupCount': 10,
'encoding': 'utf-8',
'filters': [
'isAccessLog'
]
},
# 'AccessLogSysLogHandler': {
# 'class': 'logging.handlers.SysLogHandler',
# 'address': ('127.0.0.1', 514),
# 'facility': "local0",
# 'filters': [
# 'isAccessLog'
# ]
# },
'HuntLogFileHandler': {
'class': 'logging.handlers.TimedRotatingFileHandler',
'level': 'INFO',
'formatter': 'HuntLogFileFormatter',
'filename': './log/hunting.log',
'when': 'MIDNIGHT',
'backupCount': 10,
'encoding': 'utf-8',
'filters': [
'isHuntLog'
]
},
'HuntResultLogFileHandler': {
'class': 'logging.handlers.TimedRotatingFileHandler',
'level': 'INFO',
'formatter': 'HuntLogFileFormatter',
'filename': './log/hunt_result.log',
'when': 'MIDNIGHT',
'backupCount': 10,
'encoding': 'utf-8',
'filters': [
'isHuntResultLog'
]
},
},
'formatters': {
'consoleFormatter': {
'format': '%(asctime)s [%(levelname)-8s] %(funcName)s - %(message)s',
'datefmt': '%Y-%m-%d %H:%M:%S%z'
},
'logFileFormatter': {
'format': '%(asctime)s|%(levelname)-8s|%(name)s|%(funcName)s|%(message)s',
'datefmt': '%Y-%m-%d %H:%M:%S%z'
},
'AccessLogFileFormatter': {
'format': '%(message)s',
'datefmt': '%Y-%m-%d %H:%M:%S%z'
},
'HuntLogFileFormatter': {
'format': '[%(asctime)s] %(message)s',
'datefmt': '%Y-%m-%d %H:%M:%S%z'
},
'HuntResultLogFileFormatter': {
'format': '[%(asctime)s] %(message)s',
'datefmt': '%Y-%m-%d %H:%M:%S%z'
},
}
}