diff --git a/handler/analyzer/analyze_log.py b/handler/analyzer/analyze_log.py index e88dc2a9..62d693a8 100644 --- a/handler/analyzer/analyze_log.py +++ b/handler/analyzer/analyze_log.py @@ -19,6 +19,7 @@ import os import re import threading +import uuid import tabulate @@ -214,13 +215,14 @@ def __handle_from_node(self, node, local_store_parent_dir): from_datetime_timestamp = TimeUtils.timestamp_to_filename_time(TimeUtils.datetime_to_timestamp(self.from_time_str)) to_datetime_timestamp = TimeUtils.timestamp_to_filename_time(TimeUtils.datetime_to_timestamp(self.to_time_str)) gather_dir_name = "ob_log_{0}_{1}_{2}".format(ssh_client.get_name(), from_datetime_timestamp, to_datetime_timestamp) - gather_dir_full_path = "{0}/{1}".format(self.gather_ob_log_temporary_dir, gather_dir_name) + gather_dir_full_path = "{0}/{1}_{2}".format(self.gather_ob_log_temporary_dir, gather_dir_name, str(uuid.uuid4())[:6]) mkdir(ssh_client, gather_dir_full_path) log_list, resp = self.__handle_log_list(ssh_client, node, resp) if resp["skip"]: return resp, node_results self.stdio.print(FileUtil.show_file_list_tabulate(remote_ip, log_list, self.stdio)) + self.stdio.start_loading("analyze log start") for log_name in log_list: if self.directly_analyze_files: self.__pharse_offline_log_file(ssh_client, log_name=log_name, local_store_dir=local_store_dir) @@ -228,10 +230,9 @@ def __handle_from_node(self, node, local_store_parent_dir): else: self.__pharse_log_file(ssh_client, node=node, log_name=log_name, gather_path=gather_dir_full_path, local_store_dir=local_store_dir) analyze_log_full_path = "{0}/{1}".format(local_store_dir, log_name) - self.stdio.print('analyze log start') file_result = self.__parse_log_lines(analyze_log_full_path) - self.stdio.print('analyze log sucess') node_results.append(file_result) + self.stdio.stop_loading("succeed") delete_file(ssh_client, gather_dir_full_path, self.stdio) ssh_client.ssh_close() return resp, node_results