From 0318d148663c073d05ebf44cbb06cde745d9aa75 Mon Sep 17 00:00:00 2001 From: jingyd66 <1071948456@qq.com> Date: Fri, 6 Sep 2024 17:20:11 +0800 Subject: [PATCH] update1720 --- handler/analyzer/analyze_queue.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/handler/analyzer/analyze_queue.py b/handler/analyzer/analyze_queue.py index a8c568f9..76cfe324 100644 --- a/handler/analyzer/analyze_queue.py +++ b/handler/analyzer/analyze_queue.py @@ -346,11 +346,18 @@ def __pharse_log_file(self, ssh_client, node, log_name, gather_path, local_store home_path = node.get("home_path") log_path = os.path.join(home_path, "log") local_store_path = "{0}/{1}".format(local_store_dir, log_name) + obs_log_path = "{0}/{1}".format(log_path, log_name) + gather_log_path = "{0}/{1}".format(gather_path, log_name) + self.stdio.verbose("obs_log_path {0}".format(obs_log_path)) + self.stdio.verbose("gather_log_path {0}".format(gather_log_path)) self.stdio.verbose("local_store_path {0}".format(local_store_path)) - tenant_id_str = f"tenant={{id:{self.tenant_id}}}" - search_pattern = f"'''dump tenant info({tenant_id_str},'''" - command = ['grep', '-e', search_pattern, log_name] - grep_cmd = ' '.join(command) + f' >> {local_store_path}' + self.stdio.verbose("log_name {0}".format(log_name)) + pattern = "dump tenant info(tenant={id:tenant_id," + search_pattern = pattern.replace("{id:tenant_id,", f"{{id:{self.tenant_id},") + search_pattern = '"' + search_pattern + '"' + self.stdio.verbose("search_pattern = [{0}]".format(search_pattern)) + command = ['grep', search_pattern, obs_log_path] + grep_cmd = ' '.join(command) + f' >> {gather_log_path}' self.stdio.verbose("grep files, run cmd = [{0}]".format(grep_cmd)) ssh_client.exec_cmd(grep_cmd) log_full_path = "{gather_path}/{log_name}".format(log_name=log_name, gather_path=gather_path)