-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdenemey.py
More file actions
33 lines (22 loc) · 868 Bytes
/
Copy pathdenemey.py
File metadata and controls
33 lines (22 loc) · 868 Bytes
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
import os
from SystemQuery.system_query import SystemQuery
class LinuxlogSS:
def __init__(self):
self.sistem = SystemQuery()
print("Log analizi basliyor")
self.log_files = {
"syslog": "/var/log/syslog",
"auth": "/var/log/auth.log",
"kernel": "/var/log/kern.log",
"boot": "/var/log/boot.log",
"apache2": "/var/log/apache2/error.log",
"mysql": "/var/log/mysql/error.log"
}
self.output_ls = "log_Files"
os.makedirs(output_ls, exist_ok=True)
def save_or_read_logs(self, name , path):
with open(path, 'r') as f:
logs = f.readlines()
out_path = os.path.join(self.output_ls, f"{name}_log.txt")
with open(path, 'w') as out:
reads = out.writelines()