主要工作代码
import json
import os
import re
import time
import requests
import yaml
# host_ip = ""
def get_log_path_dict():
avira_log_path = "/home/xxx/logs/xxx"
for root, dirs, files in os.walk(avira_log_path):
log_path_dict = dict()
for dir_name in dirs:
dir_path = os.path.join(root, dir_name)
log_path = dir_path + "/xxx.log"
log_path_dict[dir_name] = log_path
return log_path_dict
def time_msg2timestamp(time_msg):
time_list = time.strptime(time_msg, "%Y-%m-%d %H:%M:%S")
timestamp = int(time.mktime(time_list))