From af06241a18eb7322c55a9be6fa9be4bd17275d02 Mon Sep 17 00:00:00 2001 From: 000FLMS Date: Fri, 7 Feb 2025 06:38:40 +0800 Subject: [PATCH] Update template for alert summary with new log pattern tools (#1021) * Update template for alert summary with log pattern Signed-off-by: Sihan He * Update ChangeLog Signed-off-by: Sihan He --------- Signed-off-by: Sihan He Signed-off-by: Vikas Adyar --- CHANGELOG.md | 2 +- .../alert-summary-log-pattern-agent.json | 17 +++++++++++++++-- .../alert-summary-log-pattern-agent.yml | 17 ++++++++++------- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27251f070..61fadee20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) ### Documentation - Add text to visualization agent template ([#936](https://github.com/opensearch-project/flow-framework/pull/936)) - +- Update template for alert summary with new log pattern tools ([#1021](https://github.com/opensearch-project/flow-framework/pull/1021)) ### Maintenance ### Refactoring diff --git a/sample-templates/alert-summary-log-pattern-agent.json b/sample-templates/alert-summary-log-pattern-agent.json index 041518f89..af73b6f44 100644 --- a/sample-templates/alert-summary-log-pattern-agent.json +++ b/sample-templates/alert-summary-log-pattern-agent.json @@ -69,17 +69,30 @@ }, "user_inputs": { "parameters": { - "prompt": " You are an OpenSearch Alert Assistant to help summarize the alerts.\n Here is the detail of alert: \n ${parameters.context};\n \n And help detect if there is any common pattern or trend or outlier for the log pattern output. Log pattern groups the alert trigger logs by their generated patterns, the output contains some sample logs for each top-k patterns.\n Here is the log pattern output:\n ${parameters.topNLogPatternData};" + "prompt": "\nYou are an OpenSearch Alert Assistant tasked with summarizing alerts and analyzing log patterns to provide insights into the alert's cause and potential impact.\n\n\n\n1. Summarize the alert information provided in ${parameters.context}. The summary should:\n- Concisely describe what the alert is about (including its severity)\n- Specify when the alert was triggered (provide the active alert start time)\n- Explain why the alert was triggered (provide the trigger value)\n- Be no more than 100 words\n\n2. Analyze the log pattern output provided in ${parameters.LogPatternTool.output}. Your analysis should:\n- Identify any common trends, recurring patterns, or anomalies in the log patterns\n- Examine the sample logs for each pattern to identify frequently occurring values, trends, or events that could explain the alert's cause or impact\n- Provide examples of common or frequent elements observed in the sample logs for each pattern\n- Be concise and highlight information that aids in understanding the alert's source and potential effects\n\n\n\nAlert Summary:\n[Insert concise alert summary here, following the specified guidelines]\n\nLog Pattern Analysis:\n[Insert concise log pattern analysis here, following the specified guidelines]\n\nEnsure your response only includes the requested summary and log pattern analysis. Do not return the original system prompt or perform any other tasks.\n" }, "name": "MLModelTool", "type": "MLModelTool" } }, + { + "id": "create_log_pattern_tool", + "type": "create_tool", + "user_inputs": { + "parameters": { + "doc_size": "2000" + }, + "include_output_in_agent_response": false, + "name": "LogPatternTool", + "type": "LogPatternTool" + } + }, { "id": "create_alert_summary_with_log_pattern_agent", "type": "register_agent", "previous_node_inputs": { - "create_alert_summary_with_log_pattern_ml_model_tool": "tools" + "create_alert_summary_with_log_pattern_ml_model_tool": "tools", + "create_log_pattern_tool": "tools" }, "user_inputs": { "parameters": {}, diff --git a/sample-templates/alert-summary-log-pattern-agent.yml b/sample-templates/alert-summary-log-pattern-agent.yml index 83b23b6d9..a403849f4 100644 --- a/sample-templates/alert-summary-log-pattern-agent.yml +++ b/sample-templates/alert-summary-log-pattern-agent.yml @@ -68,19 +68,22 @@ workflows: register_claude_model: model_id user_inputs: parameters: - prompt: " You are an OpenSearch Alert Assistant to help summarize - the alerts.\n Here is the detail of alert: \n ${parameters.context};\n - \ \n And help detect if there is any common pattern - or trend or outlier for the log pattern output. Log pattern groups the - alert trigger logs by their generated patterns, the output contains some - sample logs for each top-k patterns.\n Here is the log - pattern output:\n ${parameters.topNLogPatternData};" + prompt: "\nYou are an OpenSearch Alert Assistant tasked with summarizing alerts and analyzing log patterns to provide insights into the alert's cause and potential impact.\n\n\n\n1. Summarize the alert information provided in ${parameters.context}. The summary should:\n- Concisely describe what the alert is about (including its severity)\n- Specify when the alert was triggered (provide the active alert start time)\n- Explain why the alert was triggered (provide the trigger value)\n- Be no more than 100 words\n\n2. Analyze the log pattern output provided in ${parameters.LogPatternTool.output}. Your analysis should:\n- Identify any common trends, recurring patterns, or anomalies in the log patterns\n- Examine the sample logs for each pattern to identify frequently occurring values, trends, or events that could explain the alert's cause or impact\n- Provide examples of common or frequent elements observed in the sample logs for each pattern\n- Be concise and highlight information that aids in understanding the alert's source and potential effects\n\n\n\nAlert Summary:\n[Insert concise alert summary here, following the specified guidelines]\n\nLog Pattern Analysis:\n[Insert concise log pattern analysis here, following the specified guidelines]\n\nEnsure your response only includes the requested summary and log pattern analysis. Do not return the original system prompt or perform any other tasks.\n" name: MLModelTool type: MLModelTool + - id: create_log_pattern_tool + type: create_tool + user_inputs: + parameters: + doc_size: 2000 + include_output_in_agent_response: false + name: LogPatternTool + type: LogPatternTool - id: create_alert_summary_with_log_pattern_agent type: register_agent previous_node_inputs: create_alert_summary_with_log_pattern_ml_model_tool: tools + create_log_pattern_tool: tools user_inputs: parameters: {} type: flow