<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>Elastic Observability Labs - GenAI</title>
        <link>https://www.elastic.co/observability-labs</link>
        <description>Trusted security news &amp; research from the team at Elastic.</description>
        <lastBuildDate>Thu, 12 Mar 2026 21:45:40 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <image>
            <title>Elastic Observability Labs - GenAI</title>
            <url>https://www.elastic.co/observability-labs/assets/observability-labs-thumbnail.png</url>
            <link>https://www.elastic.co/observability-labs</link>
        </image>
        <copyright>© 2026. Elasticsearch B.V. All Rights Reserved</copyright>
        <item>
            <title><![CDATA[Bringing observability insights from Elastic AI Assistant to the world of GitHub Copilot]]></title>
            <link>https://www.elastic.co/observability-labs/blog/ai-assistant-to-github-copilot</link>
            <guid isPermaLink="false">ai-assistant-to-github-copilot</guid>
            <pubDate>Thu, 23 May 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[GitHub announced GitHub Copilot Extensions this week at Microsoft Build. We are working with the GitHub team to bring observability insights from Elastic AI Assistant to GitHub Copilot users.]]></description>
            <content:encoded><![CDATA[<p>GitHub <a href="https://github.blog/2024-05-21-introducing-github-copilot-extensions/">announced</a> GitHub Copilot Extensions this week at Microsoft Build. We are working with the GitHub team in the Limited Beta Program to explore bringing observability insights from Elastic AI Assistant to GitHub Copilot users.</p>
<p>Elastic’s GitHub Copilot Extension aims to combine the capabilities of GitHub Copilot and Elastic AI Assistant for Observability. This could enable developers to access critical insights from Elastic AI Assistant from GitHub Copilot Chat on GitHub.com, Visual Studio, GitHub.com, Visual Studio, and VS Code - places where they write their code.</p>
<p>Developers will be able ask questions such as</p>
<ul>
<li>What errors are active?</li>
<li>What’s the latest stacktrace for my application?</li>
<li>What caused a slowdown in the application after the last push to the dev environment?</li>
<li>How to write an ES|QL for query that my app will send to Elasticsearch?</li>
<li>What runbook from Github has been loaded into Elasticsearch and is related to the issue I’m investigating
And many more!</li>
</ul>
<p><a href="https://build.microsoft.com/en-US/sessions/acc48a7a-b412-4b4f-88a6-53ef4b2cb2bc?source=/schedule">Watch Jeff's PoC Demo@Microsoft Build 2024</a></p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/ai-assistant-to-github-copilot/elastic-copilot-vscode.png" alt="Elastic's Copilot Extension in VSCode" /></p>
<p><em>Elastic AI Assistant surfaced in GitHub Copilot Chat from our Extension (Proof of Concept)</em></p>
<h2>What is the Elastic AI Assistant for Observability</h2>
<p>The Elastic Observability AI Assistant for Observability, a user-centric tool, is a game-changer in providing contextual insights and streamlining troubleshooting within the Elastic Observability environment. By harnessing generative AI capabilities, the assistant offers open prompts that decipher error messages and propose remediation actions. It adopts a Retrieval-Augmented Generation (RAG) approach to fetch the most pertinent internal information, such as APM traces, log messages, SLOs, GitHub issues, runbooks, and more. This contextual assistance is a huge leap forward for Site Reliability Engineers (SREs) and operations teams, offering immediate, relevant solutions to issues based on existing documentation and resources, boosting developer productivity.</p>
<p>For more information on setting up and using the AI Assistant for Observability check out the blog <a href="https://www.elastic.co/observability-labs/blog/elastic-ai-assistant-observability-microsoft-azure-openai">Getting started with the Elastic AI Assistant for Observability and Microsoft Azure OpenAI</a>. Additionally, learn how <a href="https://www.elastic.co/observability-labs/blog/elastic-rag-ai-assistant-application-issues-llm-github">Elastic Observability AI Assistant uses RAG to help analyze application issues with GitHub issues</a>.</p>
<p>One unique feature of the AI Assistant is its API support. This allows you to take advantage of all the capabilities provided by the Elastic AI Assistant, and integrate them right into your workflow.</p>
<h2>What is a GitHub Copilot Extension</h2>
<p>GitHub Copilot Extensions, a new addition to GitHub Copilot, revolutionizes the developer experience by integrating a diverse array of tools and services directly into the developer's workflow. These unique extensions, crafted by partners, enable developers to interact with various services and tools using natural language within their Integrated Development Environment (IDE) or GitHub.com. This integration eliminates the need for context-switching, allowing developers to maintain their flow state, troubleshoot issues, and deploy solutions with unparalleled efficiency. These extensions will be accessible through GitHub Copilot Chat in the GitHub Marketplace, with options for organizations to create private extensions tailored to their internal tooling.</p>
<h2>What’s next</h2>
<p>We are participating in the Github Limited Beta Program as a partner and exploring the possibility of bringing Elastic GitHub Copilot Extension to the GitHub Marketplace. We are excited to unlock insights from Elastic Observability to GitHub Copilot users side by side to the code behind those services. Stay tuned!</p>
<p>Resources:</p>
<ul>
<li><a href="https://www.elastic.co/observability-labs/blog/elastic-ai-assistant-observability-microsoft-azure-openai">Getting Started with Elastic AI Assistant for Observability with Azure OpenAI</a></li>
<li><a href="https://ela.st/assistant-escapes">The Elastic AI Assistant for Observability escapes Kibana!</a></li>
<li><a href="https://www.elastic.co/observability-labs/blog/elastic-rag-ai-assistant-application-issues-llm-github">Elastic Observability AI Assistant uses RAG to help analyze application issues with GitHub issues</a></li>
<li><a href="https://www.elastic.co/observability-labs/blog/sre-troubleshooting-ai-assistant-observability-runbooks">Troubleshooting with Elastic AI Assistant using your organization's runbooks</a></li>
<li><a href="https://www.elastic.co/guide/en/observability/current/obs-ai-assistant.html">The AI Assistant Observability documentation</a></li>
<li><a href="https://github.blog/2024-05-21-introducing-github-copilot-extensions/">GitHub Copilot Extensions Blog Announcement</a></li>
<li><a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/esql.html">ES|QL documentation</a></li>
</ul>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/ai-assistant-to-github-copilot/githubcopilot-aiassistant-C-2x.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[Analyzing OpenTelemetry apps with Elastic AI Assistant and APM]]></title>
            <link>https://www.elastic.co/observability-labs/blog/analyzing-opentelemetry-apps-elastic-ai-assistant-apm</link>
            <guid isPermaLink="false">analyzing-opentelemetry-apps-elastic-ai-assistant-apm</guid>
            <pubDate>Tue, 12 Mar 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[Elastic Observability provides native OpenTelemetry support, but analyzing applications logs, metrics, and traces can be daunting. Elastic Observability not only provides AIOps features but also an AI Assistant (co-pilot) to help get to MTTR faster.]]></description>
            <content:encoded><![CDATA[<p>OpenTelemetry is rapidly becoming the most expansive project within the Cloud Native Computing Foundation (CNCF), boasting as many commits as Kubernetes and garnering widespread support from customers. Numerous companies are adopting OpenTelemetry and integrating it into their applications. Elastic® offers detailed <a href="https://www.elastic.co/blog/getting-started-opentelemetry-instrumentation-sample-app">guides</a> on implementing OpenTelemetry for applications. However, like many applications, pinpointing and resolving issues can be time-consuming.</p>
<p>The <a href="https://www.elastic.co/blog/context-aware-insights-elastic-ai-assistant-observability">Elastic AI Assistant</a> significantly enhances the process, not only in identifying but also in resolving issues. This is further enhanced by Elastic’s new Service Level Objective (SLO) capability, allowing you to streamline your entire site reliability engineering (SRE) process from detecting potential issues to enhancing the overall customer experience.</p>
<p>In this blog, we will demonstrate how you, as an SRE, can detect issues in a service equipped with OpenTelemetry. We will explore problem identification using Elastic APM, Elastic’s AIOps capabilities, and the Elastic AI Assistant.</p>
<p>We will illustrate this using the <a href="https://github.com/elastic/opentelemetry-demo">OpenTelemetry demo</a>, with a <a href="https://opentelemetry.io/docs/demo/feature-flags/">feature flag (cartService)</a> that is activated.</p>
<p>Our walkthrough will encompass two scenarios:</p>
<ol>
<li>
<p>When the SLO for cart service becomes noncompliant, we will analyze the error through Elastic APM. The Elastic AI Assistant will assist by providing a runbook and a GitHub issue to facilitate issue analysis.</p>
</li>
<li>
<p>Should the SLO for the cart service be noncompliant, we will examine the trace that indicates a high failure rate. We will employ AIOps for failure correlation and the AI Assistant to analyze logs and Kubernetes metrics directly from the Assistant.</p>
</li>
</ol>
<h2>Prerequisites and config</h2>
<p>If you plan on following this blog, here are some of the components and details we used to set up the configuration:</p>
<ul>
<li>
<p>Ensure you have an account on <a href="http://cloud.elastic.co/">Elastic Cloud</a> and a deployed stack (<a href="https://www.elastic.co/guide/en/elastic-stack/current/installing-elastic-stack.html">see instructions here</a>).</p>
</li>
<li>
<p>We used the OpenTelemetry Demo. Directions for using Elastic with OpenTelemetry Demo are <a href="https://github.com/elastic/opentelemetry-demo">here</a>.</p>
</li>
<li>
<p>Additionally you will need to connect your AI Assistant to your favorite LLM. We used Azure OpenAI GPT-4.</p>
</li>
<li>
<p>We also ran the OpenTelemetry Demo on Kubernetes, specifically on GKE.</p>
</li>
</ul>
<h2>SLO noncompliance</h2>
<p>Elastic APM recently released the SLO (Service Level Objectives) feature in <a href="https://www.elastic.co/guide/en/observability/8.12/slo.html">8.12</a>. This feature enables setting measurable performance targets for services, such as <a href="https://sre.google/sre-book/monitoring-distributed-systems/">availability, latency, traffic, errors, and saturation or define your own</a>. Key components include:</p>
<ul>
<li>
<p>Defining and monitoring SLIs (Service Level Indicators)</p>
</li>
<li>
<p>Monitoring error budgets indicating permissible performance shortfalls</p>
</li>
<li>
<p>Alerting on burn rates showing error budget consumption</p>
</li>
</ul>
<p>We set up two SLOs for cart service:</p>
<ul>
<li>
<p><strong>Availability SLO</strong> , which monitors its availability by ensuring that transactions succeed. We set up the feature flag in the OpenTelemetry application, which generates an error for EmptyCart transactions 10% of the time.</p>
</li>
<li>
<p><strong>Latency SLO</strong> to ensure transactions are not going below a specific latency, which will reduce customer experiences.</p>
</li>
</ul>
<p><img src="https://www.elastic.co/observability-labs/assets/images/analyzing-opentelemetry-apps-elastic-ai-assistant-apm/image1.png" alt="1 - SLOs" /></p>
<p>Because of the OTel cartservice feature flag, the availability SLO is triggered, and within the SLO details, we see that over a seven-day period the availability is well below our target of 99.9, at 95.5. Additionally all the error budget that was available is also exhausted.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/analyzing-opentelemetry-apps-elastic-ai-assistant-apm/image2.png" alt="2 - cart service otel" /></p>
<p>With SLO, you can easily identify when issues with customer experience occur, or when potential issues with services arise before they become potentially worse.</p>
<h2>Scenario 1: Analyzing APM trace and logs with AI Assistant</h2>
<p>Once the SLO is found as non-compliant, we can dive into cart service to investigate in Elastic APM. The following walks through the set of steps you can take in Elastic APM and how to use the AI Assistant to analyze the issue:</p>
&lt;Video vidyardUuid=&quot;FSpw53JN9Xu32V1kLQCE8z&quot; /&gt;
<p>From the video, we can see that once in APM, we took the following steps.</p>
<ol>
<li>
<p>Investigated the trace EmptyCart, which was experiencing larger than normal failure rates.</p>
</li>
<li>
<p>The trace showed a significant number of failures, which also resulted in slightly larger latency.</p>
</li>
<li>
<p>We used AIOps failure correlation to identify the potential component causing the failure, which correlated to a field value of FailedPrecondition.</p>
</li>
<li>
<p>While filtering on that value and reviewing the logs, we still couldn’t understand what this meant.</p>
</li>
<li>
<p>This is where you can use Elastic’s AI Assistant to further your understanding of the issue.</p>
</li>
</ol>
<p>AI Assistant helped us analyze the following:</p>
<ol>
<li>
<p>It helped us understand what the log message meant and that it was related to the Redis connection failure issue.</p>
</li>
<li>
<p>Because we couldn’t connect to Redis, we asked the AI Assistant to give us the metrics for the Redis Kubernetes pods.</p>
</li>
<li>
<p>We learned there were two pods for Redis from the logs over the last two hours.</p>
</li>
<li>
<p>However, we also learned that the memory of one seems to be increasing.</p>
</li>
<li>
<p>It seems that Redis restarted (hence the second pod), and with this information we could dive deeper into what happened to Redis.</p>
</li>
</ol>
<p>You can see how quickly we could correlate a significant amount of information, logs, metrics, and traces through the AI Assistant and Elastic’s APM capabilities. We didn’t have to go through multiple screens to hunt down information.</p>
<h2>Scenario 2: Analyzing APM error with AI Assistant</h2>
<p>Once the SLO is found as noncompliant, we can dive into cart service to investigate in Elastic APM. The following walks through the set of steps you can take in Elastic APM and use the AI Assistant to analyze the issue:</p>
&lt;Video vidyardUuid=&quot;dVScqDxPJWCPCeGu8WMoCw&quot; /&gt;
<p>From the video, we can see that once in APM, we took the following steps:</p>
<ol>
<li>
<p>We noticed a specific error for the APM service.</p>
</li>
<li>
<p>We investigated this in the error tab, and while we see it’s an issue with connection to Redis, we still need more information.</p>
</li>
<li>
<p>The AI Assistant helps us understand the stacktrace and provides some potential causes for the error and ways to diagnose and resolve it.</p>
</li>
<li>
<p>We also asked it for a runbook, created by our SRE team, which gives us steps to work through this particular issue.</p>
</li>
</ol>
<p>But as you can see, AI Assistant provides us not only with information about the error message but also how to diagnose it and potentially resolve it with an internal runbook.</p>
<h2>Achieving operational excellence, optimal performance, and reliability</h2>
<p>We’ve shown how an OpenTelemetry instrumented application (OTel demo) can be analyzed using Elastic’s features, especially the AI Assistant coupled with Elastic APM, AIOps, and the latest SLO features. Elastic significantly streamlines the process of identifying and resolving issues within your applications.</p>
<p>Through our detailed walkthrough of two distinct scenarios, we have seen how Elastic APM and the AI Assistant can efficiently analyze and address noncompliance with SLOs in a cart service. The ability to quickly correlate information, logs, metrics, and traces through these tools not only saves time but also enhances the overall effectiveness of the troubleshooting process.</p>
<p>The use of Elastic's AI Assistant in these scenarios underscores the value of integrating advanced AI capabilities into operational workflows. It goes beyond simple error analysis, offering insights into potential causes and providing actionable solutions, sometimes even with customized runbooks. This integration of technology fundamentally changes how SREs approach problem-solving, making the process more efficient and less reliant on manual investigation.</p>
<p>Overall, the advancements in Elastic’s APM, AIOps capabilities, and the AI Assistant, particularly in handling OpenTelemetry data, represent a significant step forward in operational excellence. These tools enable SREs to not only react swiftly to emerging issues but also proactively manage and optimize the performance and reliability of their services, thereby ensuring an enhanced customer experience.</p>
<h2>Try it out</h2>
<p>Existing Elastic Cloud customers can access many of these features directly from the <a href="https://cloud.elastic.co/">Elastic Cloud console</a>. Not taking advantage of Elastic on cloud? <a href="https://www.elastic.co/cloud/cloud-trial-overview">Start a free trial</a>.</p>
<blockquote>
<ul>
<li><a href="https://www.elastic.co/blog/service-level-objectives-slos-logs-metrics">Build better Service Level Objectives (SLOs) from logs and metrics</a></li>
<li><a href="https://www.elastic.co/blog/whats-new-elastic-observability-8-12-0">Elastic Observability 8.12: GA for AI Assistant, SLO, and Mobile APM support</a></li>
<li><a href="https://www.elastic.co/blog/native-opentelemetry-support-in-elastic-observability">Native Observability support in Elastic Observability</a></li>
<li><a href="https://www.elastic.co/blog/context-aware-insights-elastic-ai-assistant-observability">Context-aware insights using the Elastic AI Assistant for Observability</a></li>
</ul>
</blockquote>
<p><em>The release and timing of any features or functionality described in this post remain at Elastic's sole discretion. Any features or functionality not currently available may not be delivered on time or at all.</em></p>
<p><em>In this blog post, we may have used or referred to third party generative AI tools, which are owned and operated by their respective owners. Elastic does not have any control over the third party tools and we have no responsibility or liability for their content, operation or use, nor for any loss or damage that may arise from your use of such tools. Please exercise caution when using AI tools with personal, sensitive or confidential information. Any data you submit may be used for AI training or other purposes. There is no guarantee that information you provide will be kept secure or confidential. You should familiarize yourself with the privacy practices and terms of use of any generative AI tools prior to use.</em></p>
<p><em>Elastic, Elasticsearch, ESRE, Elasticsearch Relevance Engine and associated marks are trademarks, logos or registered trademarks of Elasticsearch N.V. in the United States and other countries. All other company and product names are trademarks, logos or registered trademarks of their respective owners.</em></p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/analyzing-opentelemetry-apps-elastic-ai-assistant-apm/ecs-otel-announcement-3.jpeg" length="0" type="image/jpeg"/>
        </item>
        <item>
            <title><![CDATA[Automated log parsing in Streams with ML]]></title>
            <link>https://www.elastic.co/observability-labs/blog/automated-log-parsing-ml-streams</link>
            <guid isPermaLink="false">automated-log-parsing-ml-streams</guid>
            <pubDate>Tue, 10 Feb 2026 00:00:00 GMT</pubDate>
            <description><![CDATA[Learn how a hybrid ML approach achieved 94% log parsing and 91% log partitioning accuracy through automation experiments with log format fingerprinting in Streams.]]></description>
            <content:encoded><![CDATA[<p>In modern observability stacks, ingesting unstructured logs from diverse data providers into platforms like Elasticsearch remains a challenge. Reliance on manually crafted parsing rules creates brittle pipelines, where even minor upstream code updates lead to parsing failures and unindexed data. This fragility is compounded by the scalability challenge: in dynamic microservices environments, the continuous addition of new services turns manual rule maintenance into an operational nightmare.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/automated-log-parsing-ml-streams/automated-log-parsing.png" alt="" /></p>
<p>Our goal was to transition to an automated, adaptive approach capable of handling both log parsing (field extraction) and log partitioning (source identification). We hypothesized that Large Language Models <a href="https://www.elastic.co/what-is/large-language-models">(LLMs)</a>, with their inherent understanding of code syntax and semantic patterns, could automate these tasks with minimal human intervention.</p>
<p>We are happy to announce that this feature is already available in <a href="https://www.elastic.co/elasticsearch/streams">Streams</a>!</p>
<h2>Dataset Description</h2>
<p>We chose a <a href="https://github.com/logpai/loghub">Loghub</a> collection of logs for PoC purposes. For our investigation, we selected representative samples from the following key areas:</p>
<ul>
<li>Distributed systems: We used the HDFS (Hadoop Distributed File System) and Spark datasets. These contain a mix of info, debug, and error messages typical of big data platforms.</li>
<li>Server &amp; web applications: Logs from Apache web servers and OpenSSH provided a valuable source of access, error, and security-relevant events. These are critical for monitoring web traffic and detecting potential threats.</li>
<li>Operating systems: We included logs from Linux and Windows. These datasets represent the common, semi-structured system-level events that operations teams encounter daily.</li>
<li>Mobile systems: To ensure our model could handle logs from mobile environments, we included the Android dataset. These logs are often verbose and capture a wide range of application and system-level activities on mobile devices.</li>
<li>Supercomputers: To test performance on high-performance computing (HPC) environments, we incorporated the BGL (Blue Gene/L) dataset, which features highly structured logs with specific domain terminology.</li>
</ul>
<p>A key advantage of the Loghub collection is that the logs are largely unsanitized and unlabeled, mirroring a noisy live production environment with microservice architecture.</p>
<p>Log examples:</p>
<pre><code class="language-text">[Sun Dec 04 20:34:21 2005] [notice] jk2_init() Found child 2008 in scoreboard slot 6
[Sun Dec 04 20:34:25 2005] [notice] workerEnv.init() ok /etc/httpd/conf/workers2.properties
[Mon Dec 05 11:06:51 2005] [notice] workerEnv.init() ok /etc/httpd/conf/workers2.properties
17/06/09 20:10:58 INFO output.FileOutputCommitter: Saved output of task 'attempt_201706092018_0024_m_000083_1138' to hdfs://10.10.34.11:9000/pjhe/test/1/_temporary/0/task_201706092018_0024_m_000083
17/06/09 20:10:58 INFO mapred.SparkHadoopMapRedUtil: attempt_201706092018_0024_m_000083_1138: Committed
</code></pre>
<p>In addition, we created a Kubernetes cluster with a typical web application + database set up to mine extra logs in the most common domain.</p>
<p>Example of common log fields: timestamp, log level (INFO, WARN, ERROR), source, message.</p>
<h2>Few-Shot Log Parsing with an LLM</h2>
<p>Our first set of experiments focused on a fundamental question: <strong>Can an LLM reliably identify key fields and generate consistent parsing rules to extract them?</strong></p>
<p>We asked a model to analyse raw log samples and generate log parsing rules in regular expression (regex) and <a href="https://www.elastic.co/docs/explore-analyze/scripting/grok">Grok</a> formats. Our results showed that this approach has a lot of potential, but also significant implementation challenges.</p>
<h3>High Confidence &amp; Context Awareness</h3>
<p>Initial results were promising. The LLM demonstrated a strong ability to generate parsing rules that matched the provided few-shot examples with high confidence. Besides simple pattern matching, the model showed a capacity for log understanding —it could correctly identify and name the log source (e.g., health tracking app, Nginx web app, Mongo database).</p>
<h3>The &quot;Goldilocks&quot; Dilemma of Input Samples</h3>
<p>Our experiments quickly surfaced a significant lack of robustness because of extreme <strong>sensitivity to the input sample</strong>. The model's performance fluctuates wildly based on the specific log examples included in the prompt. We observed a log similarity problem where the log sample needs to include just diverse enough logs:</p>
<ul>
<li>Too homogeneous (overfitting): If the input logs are too similar, the LLM tends to overspecify. It treats variable data—such as specific Java class names in a stack trace—as static parts of the template. This results in brittle rules that cover a tiny ratio of logs and extract unusable fields.</li>
<li>Too heterogeneous (confusion): Conversely, if the sample contains significant formatting variance—or worse, &quot;trash logs&quot; like progress bars, memory tables, or ASCII art—the model struggles to find a common denominator. It often resorts to generating complex, broken regexes or lazily over-generalizing the entire line into a single message blob field.</li>
</ul>
<h3>The Context Window Constraint</h3>
<p>We also encountered a context window bottleneck. When input logs were long, heterogeneous, or rich in extractable fields, the model's output often deteriorated, becoming &quot;messy&quot; or too long to fit into the output context window. Naturally, chunking helps in this case. By splitting logs using character-based and entity-based delimiters, we could help the model focus on extracting the main fields without being overwhelmed by noise.</p>
<h3>The consistency &amp; standardization gap</h3>
<p>Even when the model successfully generated rules, we noted slight inconsistencies:</p>
<ul>
<li>Service naming variations: The model proposes different names for the same entity (e.g., labeling the source as &quot;Spark,&quot; &quot;Apache Spark,&quot; and &quot;Spark Log Analytics&quot; in different runs).</li>
<li>Field naming variations: Field names lacked standardization (e.g., <code>id</code> vs. <code>service.id</code> vs. <code>device.id</code>). We normalized names using a standardized <a href="https://www.elastic.co/docs/reference/ecs/ecs-field-reference">Elastic field naming</a>.</li>
<li>Resolution variance: The resolution of the field extraction varied depending on how similar the input logs were to one another.</li>
</ul>
<h2>Log Format Fingerprint</h2>
<p>To address the challenge of log similarity, we introduce a high-performance heuristic: <strong>log format fingerprint (LFF)</strong>.</p>
<p>Instead of feeding raw, noisy logs directly into an LLM, we first apply a deterministic transformation to reveal the underlying structure of each message. This pre-processing step abstracts away variable data, generating a simplified &quot;fingerprint&quot; that allows us to group related logs.</p>
<p>The mapping logic is simple to ensure speed and consistency:</p>
<ol>
<li>Digit abstraction: Any sequence of digits (0-9) is replaced by a single ‘0’.</li>
<li>Text abstraction: Any sequence of alphabetical characters with whitespace is replaced by a single ‘a’.</li>
<li>Whitespace normalization: All sequences of whitespace (spaces, tabs, newlines) are collapsed into a single space.</li>
<li>Symbol preservation: Punctuation and special characters (e.g., :, [, ], /) are preserved, as they are often the strongest indicators of log structure.</li>
</ol>
<p>We introduce the log mapping approach. The basic mapping patterns include the following:</p>
<p>Digits 0-9 of any length -&gt; to ‘0.’</p>
<ul>
<li>Text (alphabetical characters with spaces) of any length -&gt; to ‘a’.</li>
<li>White spaces, tabs, and new lines -&gt; to a single space.</li>
<li>Let's look at an example of how this mapping allows us to transform the logs.</li>
</ul>
<p><img src="https://www.elastic.co/observability-labs/assets/images/automated-log-parsing-ml-streams/transform-logs.png" alt="" /></p>
<p>As a result, we obtain the following log masks:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/automated-log-parsing-ml-streams/log-masks.png" alt="" /></p>
<p>Notice the fingerprints of the first two logs. Despite different timestamps, source classes, and message content, their prefixes (<code>0/0/0 0:0:0 a a.a:</code>) are identical. This structural alignment allows us to automatically bucket these logs into the same cluster.</p>
<p>The third log, however, produces a completely divergent fingerprint (<code>0-0-0...</code>). This allows us to algorithmically separate it from the first group before we ever invoke an LLM.</p>
<h2>Bonus Part: Instant Implementation with ES|QL</h2>
<p>It’s as easy as passing this query in Discover.</p>
<pre><code class="language-esql">FROM loghub |
EVAL pattern = REPLACE(REPLACE(REPLACE(REPLACE(raw_message, &quot;[ \t\n]+&quot;, &quot; &quot;), &quot;[A-Za-z]+&quot;, &quot;a&quot;), &quot;[0-9]+&quot;, &quot;0&quot;), &quot;a( a)+&quot;, &quot;a&quot;) |
STATS total_count = COUNT(), ratio = COUNT() / 2000.0, datasources=VALUES(filename), example=TOP(raw_message, 3, &quot;desc&quot;) BY SUBSTRING(pattern, 0, 15) |
SORT total_count DESC |
LIMIT 100
</code></pre>
<p><strong>Query breakdown:</strong></p>
<p><strong>FROM</strong> loghub: Targets our index containing the raw log data.</p>
<p><strong>EVAL</strong> pattern = …: The core mapping logic. We chain REPLACE functions to perform the abstraction (e.g., digits to '0', text to 'a', etc.) and save the result in a “pattern” field.</p>
<p><strong>STATS</strong> [column1 =] expression1, … <strong>BY</strong> SUBSTRING(pattern, 0, 15):</p>
<p>This is a clustering step. We group logs that share the first 15 characters of their pattern and create aggregated fields such as total log count per group, list of log datasources, pattern prefix, 3 log examples</p>
<p><strong>SORT</strong> total_count DESC | <strong>LIMIT</strong> 100 : Surfaces the top 100 most frequent log patterns</p>
<p>The query results on LogHub are displayed below:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/automated-log-parsing-ml-streams/query-results.png" alt="" />
<img src="https://www.elastic.co/observability-labs/assets/images/automated-log-parsing-ml-streams/results.png" alt="" /></p>
<p>As demonstrated in the visualization, this “LLM-free” approach partitions logs with high accuracy. It successfully clustered 10 out of 16 data sources (based on LogHub labels) completely (&gt;90%) and achieved majority clustering in 13 out of 16 sources (&gt;60%) —all without requiring additional cleaning, preprocessing, or fine-tuning.</p>
<p>Log format fingerprint offers a pragmatic, high-impact alternative and addition to sophisticated ML solutions like <a href="https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-categorize-text-aggregation">log pattern analysis</a>. It provides immediate insights into log relationships and effectively manages large log clusters.</p>
<ul>
<li>Versatility as a primitive</li>
</ul>
<p>Thanks to <a href="https://www.elastic.co/blog/getting-started-elasticsearch-query-language">ES|QL</a> implementation, LFF serves both as a standalone tool for fast data diagnostics/visualisations, and as a building block in log analysis pipelines for high-volume use cases.</p>
<ul>
<li>Flexibility</li>
</ul>
<p>LFF is easy to customize and extend to capture specific patterns, i.e. hexadecimal numbers and IP addresses.</p>
<ul>
<li>Deterministic stability</li>
</ul>
<p>Unlike ML-based clustering algorithms, LFF logic is straightforward and deterministic. New incoming logs do not retroactively affect existing log clusters.</p>
<ul>
<li>Performance and Memory</li>
</ul>
<p>It requires minimal memory, no training or GPU making it ideal for real-time high-throughput environments.</p>
<h2>Combining Log Format Fingerprint with an LLM</h2>
<p>To validate the proposed hybrid architecture, each experiment contained a random 20% subset of the logs from each data source. This constraint simulates a real-world production environment where logs are processed in batches rather than as a monolithic historical dump.</p>
<p>The objective was to demonstrate that LFF acts as an effective compression layer. We aimed to prove that high-coverage parsing rules could be generated from small, curated samples and successfully generalized to the entire dataset.</p>
<h2>Execution Pipeline</h2>
<p>We implemented a multi-stage pipeline that filters, clusters, and applies stratified sampling to the data before it reaches the LLM.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/automated-log-parsing-ml-streams/automating-log-parsing-ai-excecusion-pipeline.png" alt="" /></p>
<ol>
<li>Two-stage hierarchical clustering</li>
</ol>
<ul>
<li>Subclasses (exact match): Logs are aggregated by identical fingerprints. Every log in one subclass shares the exact same format structure.</li>
<li>Outlier cleaning: We discard any subclasses that represent less than 5% of the total log volume. This ensures the LLM focuses on the dominant signal and won’t be sidetracked by noise or malformed logs.</li>
<li>Metaclasses (prefix match): Remaining subclasses are grouped into Metaclasses by the first N characters of the format fingerprint match. This grouping strategy effectively splits lexically similar formats under a single umbrella.We chose N=5 for Log parsing and N=15 for Log partitioning when data sources are unknown.</li>
</ul>
<ol start="2">
<li>Stratified sampling. Once the hierarchical tree is built, we construct the log sample for the LLM. The strategic goal is to maximize variance coverage while minimizing token usage.</li>
</ol>
<ul>
<li>We select representative logs from each valid subclass within the broader metaclass.</li>
<li>To manage an edge case of too numerous subclasses, we apply random down-sampling to fit the target window size.</li>
</ul>
<ol start="3">
<li>Rule generation Finally, we prompt the LLM to generate a regex parsing rule that fits all logs in the provided sample for each Metaclass. For our PoC, we used the GPT-4o mini model.</li>
</ol>
<h2>Experimental Results &amp; Observations</h2>
<p>We achieved 94% parsing accuracy and 91% partitioning accuracy on the Loghub dataset.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/automated-log-parsing-ml-streams/automating-log-parsing-results.png" alt="" /></p>
<p>The confusion matrix above illustrates log partitioning results. The vertical axis represents the actual data sources, and the horizontal axis represents the predicted data sources. The heatmap intensity corresponds to log volume, with lighter tiles indicating a higher count. The diagonal alignment demonstrates the model's high fidelity in source attribution, with minimal scattering.</p>
<h2>Our Performance Benchmarks Insights</h2>
<ul>
<li>Optimal baseline: a context window of 30–40 log samples per category proved to be the &quot;sweet spot,&quot; consistently producing robust parsing with both Regex and Grok patterns.</li>
<li>Input minimisation: we pushed the input size to 10 logs per category for Regex patterns and observed only 2% drop in parsing performance, confirming that diversity-based sampling is more critical than raw volume.</li>
</ul>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/automated-log-parsing-ml-streams/cover.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[AWS VPC Flow log analysis with GenAI in Elastic]]></title>
            <link>https://www.elastic.co/observability-labs/blog/aws-vpc-flow-log-analysis-with-genai-elastic</link>
            <guid isPermaLink="false">aws-vpc-flow-log-analysis-with-genai-elastic</guid>
            <pubDate>Fri, 07 Jun 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[Elastic has a set of embedded capabilities such as a GenAI RAG-based AI Assistant and a machine learning platform as part of the product baseline. These make analyzing the vast number of logs you get from AWS VPC Flows easier.]]></description>
            <content:encoded><![CDATA[<p>Elastic Observability provides a full observability solution, by supporting metrics, traces and logs for applications and infrastructure. In managing AWS deployments, VPC flow logs are critical in managing performance, network visibility, security, compliance, and overall management of your AWS environment. Several examples of :</p>
<ol>
<li>
<p>Where traffic is coming in from and going out to from the deployment, and within the deployment. This helps identify unusual or unauthorized communications</p>
</li>
<li>
<p>Traffic volumes detecting spikes or drops which could indicate service issues in production or an increase in customer traffic</p>
</li>
<li>
<p>Latency and Performance bottlenecks - with VPC Flow logs, you can look at latency for a flow (in and outflows), and understand patterns</p>
</li>
<li>
<p>Accepted and rejected traffic helps determine where potential security threats and misconfigurations lie. </p>
</li>
</ol>
<p>AWS VPC Logs is a great example of how logs are great. Logging is an important part of Observability, for which we generally think of metrics and tracing. However, the amount of logs an application and the underlying infrastructure output can be significantly daunting with VPC Logs. However, it also provides a significant amount of insight.</p>
<p>Before we proceed, it is important to understand what Elastic provides in managing AWS and VPC Flow logs:</p>
<ol>
<li>
<p>A full set of integrations to manage VPC Flows and the <a href="https://www.elastic.co/observability-labs/blog/aws-service-metrics-monitor-observability-easy">entire end-to-end deployment on AWS</a>. </p>
</li>
<li>
<p>Elastic has a simple-to-use <a href="https://www.elastic.co/observability-labs/blog/aws-kinesis-data-firehose-observability-analytics">AWS Firehose integration</a>. </p>
</li>
<li>
<p>Elastic’s tools such as <a href="https://www.elastic.co/observability-labs/blog/vpc-flow-logs-monitoring-analytics-observability">Discover, spike analysis,  and anomaly detection help provide you with better insights and analysis</a>.</p>
</li>
<li>
<p>And a set of simple <a href="https://www.elastic.co/guide/en/observability/current/monitor-amazon-vpc-flow-logs.html#aws-firehose-dashboard">Out-of-the-box dashboards</a></p>
</li>
</ol>
<p>In today’s blog, we’ll cover how Elastics’ other features can support analyzing and RCA for potential VPC flow logs even more easily. Specifically, we will focus on managing the number of rejects, as this helps ensure there weren’t any unauthorized or unusual activities:</p>
<ol>
<li>
<p>Set up an easy-to-use SLO (newly released) to detect when things are potentially degrading</p>
</li>
<li>
<p>Create an ML job to analyze different fields of the VPC Flow log</p>
</li>
<li>
<p>Using our newly released RAG-based AI Assistant to help analyze the logs without needing to know Elastic’s query language nor how to even graph on Elastic</p>
</li>
<li>
<p>ES|QL will help understand and analyze add latency for patterns.</p>
</li>
</ol>
<p>In subsequent blogs, we will use AI Assistant and ESQL to show how to get other insights beyond just REJECT/ACCEPT from VPC Flow log.</p>
<h2>Prerequisites and config</h2>
<p>If you plan on following this blog, here are some of the components and details we used to set up this demonstration:</p>
<ul>
<li>
<p>Ensure you have an account on <a href="http://cloud.elastic.co">Elastic Cloud</a> and a deployed stack (<a href="https://www.elastic.co/guide/en/elastic-stack/current/installing-elastic-stack.html">see instructions here</a>).</p>
</li>
<li>
<p>Follow the steps in the following blog to get <a href="https://github.com/aws-samples/aws-three-tier-web-architecture-workshop">AWS’s three-tier app</a> installed instructed in git, and bring in the <a href="https://www.elastic.co/observability-labs/blog/aws-kinesis-data-firehose-observability-analytics">AWS VPC Flow logs</a>.</p>
</li>
<li>
<p>Ensure you have an <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-settings.html">ML node configured</a> in your Elastic stack</p>
</li>
<li>
<p>To use the AI Assistant you will need a trial or upgrade to Platinum.</p>
</li>
</ul>
<h2>SLO with VPC Flow Logs</h2>
<p>Elastic’s SLO capability is based directly on the Google SRE Handbook. All the definitions and semantics are utilized as described in Google’s SRE handbook. Hence users can perform the following on SLOs in Elastic:</p>
<ul>
<li>Define an SLO on Logs not just metrics - Users can use KQL (log-based query), service availability, service latency, custom metric, histogram metric, or a timeslice metric.</li>
<li>Define SLO, SLI, Error budget and burn rates. Users can also use occurrence versus time slice-based budgeting. </li>
<li>Manage, with dashboards, all the SLOs in a singular location.</li>
<li>Trigger alerts from the defined SLO, whether the SLI is off, the burn rate is used up, or the error rate is X.</li>
</ul>
<p>Setting up an SLO for VPC is easy. You simply create a query you want to trigger off. In our case, we look for all the good events where <em>aws.vpcflow.action=ACCEPT</em> and we define the target at 85%. </p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/aws-vpc-flow-log-analysis-with-genai-elastic/VPCFlowSLOsetup.png" alt="Setting up SLO for VPC FLow log" /></p>
<p>As the following example shows, over the last 7 days, we have exceeded our budget by 43%. Additionally, we have not complied for the last 7 days.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/aws-vpc-flow-log-analysis-with-genai-elastic/VPCFlowSLOMiss.png" alt="VPC Flow Reject SLO" /></p>
<h2>Analyzing the SLO with AI Assistant</h2>
<p>Now that we see that there is an issue with the VPC Flows, we immediately work with the AI Assistant to start analyzing the SLO. Because it's a chat interface we simply open the AI Assistant and work through some simple analysis: (See Animated GIF for a demo below)</p>
<h3>AI Assistant analysis:</h3>
<ul>
<li>
<p><strong>what were the top 3 source.address that had <em>aws.vpcflow.action=REJECT</em> over the last 7 days, which is causing this SLO issue?</strong> - We wanted to simply see what could be causing the loss in error budget. Were there any particular source.addresses causing a heavy reject rate.</p>
<ul>
<li>
<p>The answer: A table with the highest count = 42670 and <em>source.address = 79.110.62.185</em></p>
</li>
<li>
<p>There is one singular <em>source.address</em> that is causing the loss in SLO. </p>
</li>
</ul>
</li>
<li>
<p><strong>What is the largest number of  <em>aws.vpcflow.action=REJECT</em> in a 30 min time frame for the last 3 days where the <em>source.address=79.110.62.185</em>?</strong> - After understanding that a specific source.address is causing the loss in SLO, we want to understand the averages. </p>
<ul>
<li>
<p>**The answer: ** &quot;The largest number of <em>aws.vpcflow.action=REJECT</em> in a 30-minute time frame for the last 3 days where the <em>source.address</em> is 79.110.62.185 is 229. This occurred on 2024-06-01T04:00:00.000Z.”</p>
</li>
<li>
<p>It means there must be a low REJECT rate but fairly consistent vs spiky over the last 7 days.</p>
</li>
</ul>
</li>
<li>
<p><strong>for the logs with <em>source.address</em>=&quot;79.110.62.185&quot; was there any country code of <em>source.geo.country_iso_code</em> field present. If yes what is the value</strong> - Given the last question showed a low REJECT rate, it only means that this was fairly consistent vs spiky over the last 7 days.</p>
<ul>
<li><strong>The answer:</strong> Yes, there is a country code present in the <em>source.geo.country_iso_code</em> field for logs with <em>source.address</em>=&quot;79.110.62.185&quot;. The value is BG (Bulgaria).</li>
</ul>
</li>
<li>
<p><strong>Is there a specific destination.address where <em>source.address=79.110.62.185</em> is getting a <em>aws.vpcflow.action=REJECT</em>. Give me both the destination.address and the number of REJECTs for that destination.address?</strong></p>
<ul>
<li><strong>The answer:</strong> destination.address of 10.0.0.27 is giving a reject number of 53433 in this time frame.</li>
</ul>
</li>
<li>
<p><strong>Graph the number of REJECT vs ACCEPT for <em>source.address</em>=&quot;79.110.62.185&quot; over the last 7 days. The graph is on a daily basis in a singular graph</strong> - We asked this question to see what the comparison is between ACCEPT and REJECT. </p>
<ul>
<li><strong>The answer:</strong> See the animated GIF to see that the generated graph is fairly stable</li>
</ul>
</li>
<li>
<p><strong>Were there any source.address that had a spike, high reject rate in. a 30min period over the 30 days?</strong> - We wanted to see if there was any other spike </p>
<ul>
<li><strong>The answer</strong> - Yes, there was a source.address that had a spike in high reject rates in a 30-minute period over the last 30 days. <em>source.address</em>: 185.244.212.67, Reject Count: 8975, Time Period: 2024-05-22T03:00:00.000Z</li>
</ul>
</li>
</ul>
<hr />
<h3>Watch the flow</h3>
&lt;Video vidyardUuid=&quot;1jvEpzfkci9j6AoL42XWA3&quot; /&gt;
<h3>Potential issue:</h3>
<p>he server handling requests from source <strong><em>79.110.62.185</em></strong> is potentially having an issue.</p>
<p>Again using logs, we essentially asked the AI Assistant to give the <em>eni</em> ids where the internal ip address was 10.0.0.27</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/aws-vpc-flow-log-analysis-with-genai-elastic/VPCFlow-findingwebserver.png" alt="Finding the issue - webserver" /></p>
<p>From our AWS console, we know that this is the webserver. Further analysis in Elastic, and with the developers we realized there is a new version that was installed recently causing a problem with connections.</p>
<h2>Locating anomalies with ML</h2>
<p>While using the AI Assistant is great for analyzing information, another important aspect of VPC flow management is to ensure you can manage log spikes and anomalies. Elastic has a machine learning platform that allows you to develop jobs to analyze specific metrics or multiple metrics to look for anomalies.</p>
<p>VPC Flow logs come with a large amount of information. The full set of fields is listed in <a href="https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs.html#flow-logs-basics">AWS docs</a>. We will use a specific subset to help detect anomalies.</p>
<p>We were setting up anomalies for aws.vpcflow.action=REJECT, which requires us to use multimetric anomaly detection in Elastic.</p>
<p>The config we used utilizes:</p>
<p>Detectors:</p>
<ul>
<li>
<p>destination.address</p>
</li>
<li>
<p>destination.port</p>
</li>
</ul>
<p>Influencers:</p>
<ul>
<li>
<p>source.address</p>
</li>
<li>
<p>aws.vpcflow.action</p>
</li>
<li>
<p>destination.geo.region_iso_code</p>
</li>
</ul>
<p>The way we set this up will help us understand if there is a large spike in REJECT/ACCEPT against <em>destination.address</em> values from a specific <em>source.address</em> and/or <em>destination.geo.region_iso_code</em> location.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/aws-vpc-flow-log-analysis-with-genai-elastic/VPCFlowanomalysetup.png" alt="Anomaly detection job config" /></p>
<p>The job once run reveals something interesting:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/aws-vpc-flow-log-analysis-with-genai-elastic/VPCFlowAnomalyDetection.png" alt="Anomaly detected" /></p>
<p>Notice that <em>source.address</em> 185.244.212.67 has had a high REJECT rate in the last 30 days. </p>
<p>Notice where we found this before? In the AI Assistant!!!!!</p>
<p>While we can run the AI Assistant and find this sort of anomaly, the ML job can be setup to run continuously and alert us on such spikes. This will help us understand if there are any issues with the webserver like we found above or even potential security attacks.</p>
<h2>Conclusion:</h2>
<p>You’ve now seen how easily Elastic’s RAG-based AI Assistant can help analyze VPC Flows without even the need to know query syntax, understand where the data is, and understand even the fields. Additionally, you’ve also seen how we can alert you when a potential issue or degradation in service (SLO). Check out our other blogs on AWS VPC Flow analysis in Elastic:</p>
<ol>
<li>
<p>A full set of integrations to manage VPC Flows and the <a href="https://www.elastic.co/observability-labs/blog/aws-service-metrics-monitor-observability-easy">entire end-to-end deployment on AWS</a>. </p>
</li>
<li>
<p>Elastic has a simple-to-use <a href="https://www.elastic.co/observability-labs/blog/aws-kinesis-data-firehose-observability-analytics">AWS Firehose integration</a>. </p>
</li>
<li>
<p>Elastic’s tools such as <a href="https://www.elastic.co/observability-labs/blog/vpc-flow-logs-monitoring-analytics-observability">Discover, spike analysis,  and anomaly detection help provide you with better insights and analysis</a>.</p>
</li>
<li>
<p>And a set of simple <a href="https://www.elastic.co/guide/en/observability/current/monitor-amazon-vpc-flow-logs.html#aws-firehose-dashboard">Out-of-the-box dashboards</a></p>
</li>
</ol>
<h2>Try it out</h2>
<p>Existing Elastic Cloud customers can access many of these features directly from the <a href="https://cloud.elastic.co/">Elastic Cloud console</a>. Not taking advantage of Elastic on the cloud? <a href="https://www.elastic.co/cloud/cloud-trial-overview">Start a free trial</a>.</p>
<p>All of this is also possible in your environment. <a href="https://www.elastic.co/observability/universal-profiling">Learn how to get started today</a>.</p>
<p><em>The release and timing of any features or functionality described in this post remain at Elastic's sole discretion. Any features or functionality not currently available may not be delivered on time or at all.</em></p>
<p><em>In this blog post, we may have used or referred to third party generative AI tools, which are owned and operated by their respective owners. Elastic does not have any control over the third party tools and we have no responsibility or liability for their content, operation or use, nor for any loss or damage that may arise from your use of such tools. Please exercise caution when using AI tools with personal, sensitive or confidential information. Any data you submit may be used for AI training or other purposes. There is no guarantee that information you provide will be kept secure or confidential. You should familiarize yourself with the privacy practices and terms of use of any generative AI tools prior to use.</em></p>
<p><em>Elastic, Elasticsearch, ESRE, Elasticsearch Relevance Engine and associated marks are trademarks, logos or registered trademarks of Elasticsearch N.V. in the United States and other countries. All other company and product names are trademarks, logos or registered trademarks of their respective owners.</em></p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/aws-vpc-flow-log-analysis-with-genai-elastic/21-cubes.jpeg" length="0" type="image/jpeg"/>
        </item>
        <item>
            <title><![CDATA[Elastic Observability: Streams Data Quality and Failure Store Insights]]></title>
            <link>https://www.elastic.co/observability-labs/blog/data-quality-and-failure-store-in-streams</link>
            <guid isPermaLink="false">data-quality-and-failure-store-in-streams</guid>
            <pubDate>Tue, 18 Nov 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[Discover how the Streams a new AI driven Elastic Observability feature help manage data quality with a failure store to help you monitor, troubleshoot, and retain high-quality data.]]></description>
            <content:encoded><![CDATA[<p>When working with observability and logging data, not all documents make it into Elasticsearch in pristine condition. Some may be dropped due to processing failures in ingest pipelines or mapping errors, while others may be partially ingested with ignored fields if a fields value is incompatible with the defined mappings. These issues can impact downstream analysis and dashboards. Streams data quality makes it easier than ever to monitor the health of your ingested data, identify potential issues, and take corrective action right from the UI. With data quality, you can now see exactly how well your Stream is performing and quickly understand whether your data has a <strong>Good</strong>, <strong>Degraded</strong>, or <strong>Poor</strong> quality.</p>
<h2>What's in data quality</h2>
<p><img src="https://www.elastic.co/observability-labs/assets/images/data-quality-and-failure-store-in-streams/data-quality-tab.png" alt="Data quality tab" /></p>
<h3>At-a-glance summary</h3>
<p>The summary card shows:</p>
<ul>
<li><strong>Degraded documents</strong> - Documents that contain the <code>_ignored</code> field - see <a href="https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/mapping-ignored-field">this</a> for more info.</li>
<li><strong>Failed documents</strong> - Documents that were rejected at ingestion due to mapping conflicts or pipeline failures.</li>
</ul>
<p>The overall <strong>quality score</strong> (Good, Degraded, Poor) is automatically calculated based on the percentage of degraded and failed documents.</p>
<h3>Trends over time</h3>
<p>The tab includes a time-series chart so you can track how degraded and failed documents are accumulating over time. Use the <strong>date picker</strong> to zoom into a specific range and understand when problems are spiking.</p>
<h3>Quality issues table</h3>
<p>A detailed table lists the types of issues affecting your stream. For each issue, you can:</p>
<ul>
<li>See which fields are causing problems.</li>
<li>Review counts of affected documents.</li>
<li>Filter by issues that have not been solved yet (Current issues only).</li>
<li>Open a <strong>flyout</strong> to dive deeper into the cause of the issue and learn how to fix it.</li>
</ul>
<p><img src="https://www.elastic.co/observability-labs/assets/images/data-quality-and-failure-store-in-streams/quality-issue-flyout.png" alt="Data quality issue flyout" /></p>
<h2>Monitoring degraded documents</h2>
<p>A degraded document is one that contains the <code>_ignored</code> field, which means one or more of its fields were ignored during indexing. One of the reasons could be that their values didn’t match the expected mappings. While the rest of the document is still indexed, a high number of degraded documents can affect query results, dashboards, and overall observability accuracy.</p>
<p>To help keep these issues under control, the Data quality tab provides visibility into the percentage of degraded documents in your stream.</p>
<h3>Set up a rule to stay ahead of issues</h3>
<p>You can use the <strong>Create rule</strong> button above the Degraded docs chart to define an alert that notifies you when the percentage of degraded documents crosses a certain threshold. This makes it easy to proactively monitor for mapping mismatches and ensure your data continues to meet quality expectations.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/data-quality-and-failure-store-in-streams/create-rule-button.png" alt="Create rule button" /></p>
<p>For more information on how to configure this rule, see <a href="https://www.elastic.co/docs/solutions/observability/incident-management/create-a-degraded-docs-rule#degraded-docs-rule-conditions">Degraded docs rule conditions</a>.</p>
<h2>Handling failed documents with the failure store</h2>
<p><a href="https://www.elastic.co/docs/manage-data/data-store/data-streams/failure-store"><strong>Failure store</strong></a> is a special index that captures documents rejected during ingestion. Instead of losing this data, the failure store retains it in a dedicated <code>::failures</code> index, allowing you to inspect the problematic documents, understand what went wrong, and fix the underlying issues.</p>
<p>In Data Quality tab, the failed documents are only visible if your stream has a failure store enabled, for checking failure store documents you are required to have at least <code>read_failure_store</code> privileges. If the failure store is <strong>not enabled</strong>, you’ll see an <strong>“Enable failure store”</strong> link that opens a modal to configure it and set the retention period. For enabling failure store you are required to have <code>manage_failure_store</code> privileges over the specific data stream. For further information about failure store security you can refer to <a href="https://www.elastic.co/docs/manage-data/data-store/data-streams/failure-store#use-failure-store-searching">Searching failures</a>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/data-quality-and-failure-store-in-streams/enable-fs-link.png" alt="Enable failure store link" /></p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/data-quality-and-failure-store-in-streams/failure-store-modal.png" alt="Failure store configuration modal" /></p>
<p>Once enabled, you can <strong>edit the failure store configuration</strong> or disable it at any time using the <strong>Edit</strong> button above the failed docs chart.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/data-quality-and-failure-store-in-streams/edit-fs-button.png" alt="Edit failure store button" /></p>
<p>The failure store can also be configured in the Streams Retention tab - see <a href="https://www.elastic.co/observability-labs/blog/simplifying-retention-management-with-streams.mdx">this article</a> for more information.</p>
<h2>Technical implementation</h2>
<p>Under the hood, the <strong>Data quality</strong> tab builds on the existing <strong>Dataset quality</strong> plugin - the same one that powers the <a href="https://www.elastic.co/docs/solutions/observability/data-set-quality-monitoring"><strong>Dataset quality page</strong></a> in <strong>Stack Management</strong>. However, instead of working in the context of datasets following the Data stream naming scheme, it’s now tailored specifically for <strong>streams</strong>.</p>
<p>To determine the quality of a stream, the UI sends three <strong>ES|QL</strong> query server requests:</p>
<ol>
<li><strong>All documents (including failures):</strong></li>
</ol>
<pre><code class="language-sql"> FROM myStream, myStream::failures | STATS doc_count = COUNT(*)
</code></pre>
<ol start="2">
<li><strong>Failed documents only:</strong></li>
</ol>
<pre><code class="language-sql"> FROM myStream::failures | STATS failed_doc_count = COUNT(*)
</code></pre>
<ol start="3">
<li><strong>Degraded documents:</strong></li>
</ol>
<pre><code class="language-sql">FROM myStream METADATA _ignored | WHERE _ignored IS NOT NULL | STATS degraded_doc_count = COUNT(*)
</code></pre>
<p>The results of these queries are then used to calculate the <strong>percentages</strong> of failed and degraded documents. The overall data quality is determined using simple thresholds:</p>
<ul>
<li><strong>Good:</strong> Both percentages are 0%</li>
<li><strong>Degraded:</strong> Any percentage is greater than 0% but less than 3%</li>
<li><strong>Poor:</strong> Any percentage is above 3%</li>
</ul>
<p>For managing the <strong>failure store</strong>, Streams uses the <a href="https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-data-stream-options">Update data stream options API</a> with the <code>failure_store</code> parameter to configure and update the failure store settings, including enabling the store and setting the retention period.</p>
<h2>Why you’ll love this</h2>
<p>The new <strong>Data quality</strong> tab gives you:</p>
<ul>
<li>Visibility into ingestion problems without digging into logs</li>
<li>A clear breakdown of degraded vs. failed documents</li>
<li>Insights into which fields are ignored and why</li>
<li>Tools to capture and troubleshoot failed docs with the failure store</li>
</ul>
<p>By surfacing data quality issues directly in the Streams UI, we’re making it easier to keep your data flowing reliably and to ensure your analytics are built on a strong foundation.</p>
<h2><strong>Try it out today</strong></h2>
<p>The <strong>data quality</strong> feature is available in <strong>Elastic Observability on Serverless</strong>, and coming soon for self-managed and Elastic Cloud users.</p>
<p>Sign up for an Elastic trial at <a href="http://cloud.elastic.co">cloud.elastic.co</a>, and trial Elastic's Serverless offering which will allow you to play with all of the Streams functionality.</p>
<p>For more information on Streams:</p>
<p><em>Read about</em> <a href="https://www.elastic.co/observability-labs/blog/reimagine-observability-elastic-streams"><em>Reimagining streams</em></a></p>
<p><em>Look at the</em> <a href="http://elastic.co/elasticsearch/streams"><em>Streams website</em></a></p>
<p><em>Read the</em> <a href="https://www.elastic.co/docs/solutions/observability/streams/streams"><em>Streams documentation</em></a></p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/data-quality-and-failure-store-in-streams/article.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[Getting started with the Elastic AI Assistant for Observability and Amazon Bedrock]]></title>
            <link>https://www.elastic.co/observability-labs/blog/elastic-ai-assistant-observability-amazon-bedrock</link>
            <guid isPermaLink="false">elastic-ai-assistant-observability-amazon-bedrock</guid>
            <pubDate>Fri, 03 May 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[Follow this step-by-step process to get started with the Elastic AI Assistant for Observability and Amazon Bedrock.]]></description>
            <content:encoded><![CDATA[<p>Elastic recently released version <a href="https://www.elastic.co/blog/whats-new-elastic-8-13-0">8.13, which includes the general availability of Amazon Bedrock integration for the Elastic AI Assistant for Observability</a>. This blog post will walk through the step-by-step process of setting up the Elastic AI Assistant with Amazon Bedrock. Then, we’ll show you how to add content to the AI Assistant’s knowledge base to demonstrate how the power of Elasticsearch combined with Amazon Bedrock can supercharge the answers Elastic AI Assistant provides so that they are uniquely specific to your needs.</p>
<p>Managing applications and the infrastructure they run on requires advanced observability into the diverse types of data involved like logs, traces, profiles, and metrics. General purpose generative AI large language models (LLMs) offer a new capability to provide human readable guidance to your observability questions. However, they have limitations. Specifically, when it comes to providing answers about your application’s distinct observability data like real-time metrics, the LLMs require additional context to provide answers that will help to actually resolve issues. This is a limitation that the Elastic AI Assistant for Observability can uniquely solve.</p>
<p>Elastic Observability, serving as a central datastore of all the observability data flowing from your application, combined with the Elastic AI Assistant gives you the ability to generate a context window that can inform an LLM’s responses and vastly improve the answers it provides. For example, when you ask the Elastic AI Assistant a question about a specific issue happening in your application, it gathers up all the relevant details — current errors captured from logs or a related runbook that your team has stored in the Elastic AI Assistant’s knowledge base. Then, it sends that information to the Amazon Bedrock LLM as a context window from which it can better answer your observability questions.</p>
<p>Read on to follow the steps for setting up the Elastic AI Assistant for yourself.</p>
<h2>Set up the Elastic AI Assistant for Observability: Create an Amazon Bedrock connector in Elastic Cloud</h2>
<p>Start by creating an Elastic Cloud 8.13 deployment via the <a href="https://aws.amazon.com/marketplace/pp/prodview-voru33wi6xs7k">AWS marketplace</a>. If you’re a new user of Elastic Cloud, you can create a new deployment with a 7-day free trial.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/1.png" alt="1" /></p>
<p>Sign in to the Elastic Cloud deployment you’ve created. From the top level menu, select <strong>Stack Management</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/2.png" alt="2" /></p>
<p>Select <strong>Connectors</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/3.png" alt="3" /></p>
<p>Click the <strong>Create connector</strong> button.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/4.png" alt="4" /></p>
<h2>Enable Amazon Bedrock model access</h2>
<p>For populating the required connector settings, enable Amazon Bedrock model access in the AWS console using the following steps.</p>
<p>In a new browser tab, open <a href="https://console.aws.amazon.com/bedrock/">Amazon Bedrock</a> and click the <strong>Get started</strong> button.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/5.png" alt="5" /></p>
<p>Currently, access to the Amazon Bedrock foundation models is granted by requesting access using the Bedrock <strong>Model access</strong> section in the AWS console.</p>
<p>Select <strong>Model access</strong> from the navigation menu.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/6.png" alt="6" /></p>
<p>To request access, select the foundation models that you want to access and click the <strong>Save Changes</strong> button. For this blog post, we will choose the Anthropic Claude models.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/7.png" alt="7" /></p>
<p>Once access is granted, the <strong>Manage model</strong> <strong>access</strong> settings will indicate that access has been granted.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/8.png" alt="8" /></p>
<h3>Create AWS IAM User</h3>
<p>Create an <a href="https://aws.amazon.com/iam/">IAM</a> user and assign it a role with <a href="https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonBedrockFullAccess.html">Amazon Bedrock full access</a> and also <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html">generate an IAM access key and secret key</a> in the console. If you already have an IAM user with a generated access key and secret key, you can use the existing credentials to access Amazon Bedrock.</p>
<h3>Configure Elastic connector to use Amazon Bedrock</h3>
<p>Back in the Elastic Cloud deployment create connector flyout, select the connector for Amazon Bedrock.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/9.png" alt="9" /></p>
<p>Enter a <strong>Name</strong> of your choice for the connector. Also, enter the <strong>Access Key</strong> and <strong>Key Secret</strong> that you copied in a previous step. Click the <strong>Save &amp; test</strong> button to create the connector.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/10.png" alt="10" /></p>
<p>Within the <strong>Edit Connector</strong> flyout window, click the <strong>Run</strong> button to confirm that the connector configuration is valid and can successfully connect to your Amazon Bedrock instance.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/11.png" alt="11" /></p>
<p>You should see confirmation that the connector test was successful.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/12.png" alt="12" /></p>
<h3>Add an example logs record</h3>
<p>Now that the connector is configured, let's add a logs record to demonstrate how the Elastic AI Assistant can help you to better understand the diverse types of information contained within logs.</p>
<p>Use the Elastic Dev Tools to add a single logs record. Click the top-level menu and select <strong>Dev Tools</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/13.png" alt="13" /></p>
<p>Within the console area of Dev Tools, enter the following POST statement:</p>
<pre><code class="language-json">POST /logs-elastic_agent-default/_doc
{
    &quot;message&quot;: &quot;Status(StatusCode=\&quot;BadGateway\&quot;, Detail=\&quot;Error: The server encountered a temporary error and could not complete your request\&quot;).&quot;,
    &quot;@timestamp&quot;: &quot;2024-04-21T10:33:00.884Z&quot;,
    &quot;log&quot;: {
   	 &quot;level&quot;: &quot;error&quot;
    },
    &quot;service&quot;: {
   	 &quot;name&quot;: &quot;proxyService&quot;
    },
    &quot;host&quot;: {
   	 &quot;name&quot;: &quot;appserver-2&quot;
    }
}
</code></pre>
<p>Then run the POST command by clicking the green <strong>Run</strong> button.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/14.png" alt="14" /></p>
<p>You should see a 201 response confirming that the example logs record was successfully created.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/15.png" alt="15" /></p>
<h3>Use the Elastic AI Assistant</h3>
<p>Now that you have a log entry, let’s use the AI Assistant to see how it interacts with logs data. Click the top-level menu and select <strong>Observability</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/16.png" alt="16" /></p>
<p>Select <strong>Logs</strong> <strong>Explorer</strong> under Observability.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/17.png" alt="17" /></p>
<p>In the Logs Explorer search box, enter the text “badgateway” and press the <strong>Enter</strong> key to perform the search.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/18.png" alt="18" /></p>
<p>Click the <strong>View all matches</strong> button to include all search results.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/19.png" alt="19" /></p>
<p>You should see the one log record that you previously inserted via Dev Tools. Click the expand icon in the <strong>actions</strong> column to see the log record’s details.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/20.png" alt="20" /></p>
<p>You should see the expanded view of the logs record. Let’s use the AI Assistant to summarize it. Click on the <strong>What's this message?</strong> button.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/21.png" alt="21" /></p>
<p>We get a fairly generic answer back. Depending on the exception or error we're trying to analyze, this can still be really useful, but we can improve this response by adding additional documentation to the AI Assistant knowledge base.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/22.png" alt="22" /></p>
<p>Let’s add an entry in AI Assistant’s knowledge base to improve its understanding of this specific logs message.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/23.png" alt="23" /></p>
<p>Click the <strong>AI Assistant</strong> button at the top right of the window.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/24.png" alt="24" /></p>
<p>Click the <strong>Install Knowledge base</strong> button.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/25.png" alt="25" /></p>
<p>Click the top-level menu and select <strong>Stack Management</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/26.png" alt="26" /></p>
<p>Then select <strong>AI Assistants</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/27.png" alt="27" /></p>
<p>Click <strong>Elastic AI Assistant for Observability</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/28.png" alt="28" /></p>
<p>Select the <strong>Knowledge base</strong> tab.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/29.png" alt="29" /></p>
<p>Click the <strong>New entry</strong> button and select <strong>Single entry</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/30.png" alt="30" /></p>
<p>Give it the <strong>Name</strong> “proxyservice” and enter the following text as the <strong>Contents</strong> :</p>
<pre><code class="language-markdown">
​​I have the following runbook located on Github. Store this information in your knowledge base and always include the link to the runbook in your response if the topic is related to a bad gateway error.

Runbook Link: https://github.com/elastic/observability-aiops/blob/main/ai_assistant/runbooks/slos/502-errors.md

Runbook Title: Handling 502 Bad Gateway Errors

Summary: This is likely an issue with Nginx proxy configuration

Body: This runbook provides instructions for diagnosing and resolving 502 Bad Gateway errors in your system.
</code></pre>
<p>Click <strong>Save</strong> to save the new knowledge base entry.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/31.png" alt="31" /></p>
<p>Now let’s go back to the Observability Logs Explorer. Click the top-level menu and select <strong>Observability</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/32.png" alt="32" /></p>
<p>Then select <strong>Explorer</strong> under <strong>Logs</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/33.png" alt="33" /></p>
<p>Expand the same logs entry as you did previously and click the <strong>What’s this message?</strong> button.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/34.png" alt="34" /></p>
<p>The response you get now should be much more relevant.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/35.png" alt="35" /></p>
<h2>Try out the Elastic AI Assistant with a knowledge base filled with your own data</h2>
<p>Now you’ve seen the complete process of connecting the Elastic AI Assistant to Amazon Bedrock. You’ve also seen how to use the AI Assistant’s knowledge base to store custom remediation documentation like runbooks that the AI Assistant can leverage to generate more helpful responses. Steps like this can help you remediate issues more quickly when they happen. Try out the Elastic AI Assistant with your own logs and custom knowledge base.</p>
<p>Start a <a href="https://aws.amazon.com/marketplace/pp/prodview-voru33wi6xs7k?trk=5fbc596b-6d2a-433a-8333-0bd1f28e84da%E2%89%BBchannel=el">7-day free trial</a> by signing up via <a href="https://aws.amazon.com/marketplace/pp/prodview-voru33wi6xs7k">AWS Marketplace</a> and quickly spin up a deployment in minutes on any of the <a href="https://www.elastic.co/guide/en/cloud/current/ec-reference-regions.html#ec_amazon_web_services_aws_regions">Elastic Cloud regions on AWS</a> around the world.</p>
<p><em>The release and timing of any features or functionality described in this post remain at Elastic's sole discretion. Any features or functionality not currently available may not be delivered on time or at all.</em></p>
<p><em>In this blog post, we may have used or referred to third party generative AI tools, which are owned and operated by their respective owners. Elastic does not have any control over the third party tools and we have no responsibility or liability for their content, operation or use, nor for any loss or damage that may arise from your use of such tools. Please exercise caution when using AI tools with personal, sensitive or confidential information. Any data you submit may be used for AI training or other purposes. There is no guarantee that information you provide will be kept secure or confidential. You should familiarize yourself with the privacy practices and terms of use of any generative AI tools prior to use.</em></p>
<p><em>Elastic, Elasticsearch, ESRE, Elasticsearch Relevance Engine and associated marks are trademarks, logos or registered trademarks of Elasticsearch N.V. in the United States and other countries. All other company and product names are trademarks, logos or registered trademarks of their respective owners.</em></p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-amazon-bedrock/AI_hand.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[The Elastic AI Assistant for Observability escapes Kibana!]]></title>
            <link>https://www.elastic.co/observability-labs/blog/elastic-ai-assistant-observability-escapes-kibana</link>
            <guid isPermaLink="false">elastic-ai-assistant-observability-escapes-kibana</guid>
            <pubDate>Mon, 08 Apr 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[Harness the Elastic AI Assistant API to seamlessly blend Elastic's Observability capabilities into your daily workflow, from Slack to the command line, boosting efficiency and decision-making. Work smarter, not harder.]]></description>
            <content:encoded><![CDATA[<p><em>Note: The API described below is currently under development and undocumented, and thus it is not supported. Consider this a forward-looking blog. Features are not guaranteed to be released.</em></p>
<p>Elastic, time-saving assistants, generative models, APIs, Python, and the potential to show a new way of working with our technology? Of course, I would move this to the top of my project list!</p>
<p>If 2023 was the year of figuring out generative AI and retrieval augmented generation (RAG), then 2024 will be the year of productionalizing generative AI RAG applications. Companies are beginning to publish references and architectures, and businesses are integrating generative applications into their lines of business.</p>
<p>Elastic is following suit by integrating not one but two AI Assistants into Kibana: one in <a href="https://www.elastic.co/guide/en/observability/current/obs-ai-assistant.html">Observability</a> and one in <a href="https://www.elastic.co/guide/en/security/current/security-assistant.html">Security</a>. Today, we will be working with the former.</p>
<h2>The Elastic AI Assistant for Observability</h2>
<p>What is the Observability AI Assistant? Allow me to <a href="https://www.elastic.co/guide/en/security/current/security-assistant.html">quote the documentation</a>:</p>
<p><em>The AI Assistant uses generative AI to provide:</em></p>
<ul>
<li>
<p>_ <strong>Contextual insights:</strong> _ <em>Open prompts throughout Observability that explain errors and messages and suggest remediation. This includes your own GitHub issues, runbooks, architectural images, etc. Essentially, anything internally that is useful for the SRE and stored in Elastic can be used to suggest resolution.</em> <a href="https://www.elastic.co/blog/sre-troubleshooting-ai-assistant-observability-runbooks"><em>Elastic AI Assistant for Observability uses RAG to get the most relevant internal information</em></a><em>.</em></p>
</li>
<li>
<p>_ <strong>Chat:</strong> _ <em>Have conversations with the AI Assistant. Chat uses function calling to request, analyze, and visualize your data.</em></p>
</li>
</ul>
<p>In other words, it's a chatbot built into the Observability section of Kibana, allowing SREs and operations people to perform their work faster and more efficiently. In the theme of integrating generative AI into lines of business, these AI Assistants are integrated seamlessly into Kibana.</p>
<h2>Why “escape” Kibana?</h2>
<p>Kibana is a powerful tool, offering many functions and uses. The Observability section has rich UIs for logs, metrics, APM, and more. As much as I believe people in operations, SREs, and the like can get the majority of their work done in Kibana (given Elastic is collecting the relevant data), having worked in the real world, I know just about everyone has multiple tools they work with.</p>
<p>We want to integrate with people’s workflows as much as we want them to integrate with Elastic. As such, providing API access to the AI Assistants allows Elastic to meet you where you spend most of your time. Be it Slack, Teams, or any other app that can integrate with an API.</p>
<h2>API overview</h2>
<p>Enter the AI Assistant API. The API provides most of the functionality and efficiencies the AI Assistant brings in Kibana. Since the API handles most of the functionality, it’s like having a team of developers working to improve and develop new features for you.</p>
<p>The API provides access to ask questions in natural language via <a href="https://www.elastic.co/guide/en/machine-learning/current/ml-nlp-elser.html">ELSER</a> and a group of functions the large language model (LLM) can use to gather additional information from Elasticsearch, all out of the box.</p>
<h2>Command line</h2>
<p>Enough talk; let’s look at some examples!</p>
<p>The first example of using the AI Assistant outside of Kibana is on the command-line. This command-line script allows you to ask questions and get responses. Essentially, the script uses the Elastic API to enable you to have AI Assistant interactions on your CLI (outside of Kibana) Credit for this script goes to Almudena Sanz Olivé, senior software engineer on the Observability team. Of course, I want to also credit the rest of the development team for creating the assistant! NOTE: The AI Assistant API is not yet public but Elastic is working on potentially releasing this. Stay tuned.</p>
<p>The script prints API information on a new line each time the LLM calls a function or Kibana runs a function to provide additional information about what is happening behind the scenes. The generated answer will also be written on a new line.</p>
<p>There are many ways to start a conversation with the AI Assistant. Let’s imagine I work for an ecommerce company and just checked in some code to GitHub. I realize I need to check if there are any active alerts that need to be worked on. Since I’m already on the commandline, I can run the AI Assistant CLI and ask it to check for me.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-escapes-kibana/1.png" alt="Asking the AI Assistant to list all active alerts." /></p>
<p>There are nine active alerts. It's not the worst count I’ve seen by a long shot, but they should still be addressed. There are many ways to start here, but the one that caught my attention first was related to the SLO burn rate on the service-otel cart. This service handles our customers' checkout procedures.</p>
<p>I could ask the AI Assistant to investigate this more for me, but first, let me check if there are any runbooks our SRE team has loaded into the AI Assistant’s knowledge base.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-escapes-kibana/2.png" alt="Ask the AI Assistant to check if there are runbooks to handle issues with a service." /></p>
<p>Fantastic! I can call my fantastic co-worker Luca Wintergerst and have him fix it. While I prefer tea these days, I’ll follow step two and grab a cup of coffee.</p>
<p>With that handled, let’s go have some fun with SlackBots.</p>
<h2>Slackbots</h2>
<p>Before coming to Elastic, I worked at E*Trade, where I was on a team responsible for managing several large Elasticsearch clusters. I spent a decent amount of time working in Kibana; however, as we worked on other technologies, I spent much more time outside of Kibana. One app I usually had open was Slack. Long story short, <a href="https://www.elastic.co/elasticon/tour/2018/chicago/elastic-at-etrade">I wrote a Slackbot</a> (skip to the 05:22 mark to see a brief demo of it) that could perform many operations with Elasticsearch.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-escapes-kibana/3.png" alt="Slackbot circa 2018 reporting on Elastic ML Anomalies for trade transactions by sock symbol" /></p>
<p>This worked really well. The only problem was writing all the code, including implementing basic natural language processing (NLP). All the searches were hard-coded, and the list of tasks was static.</p>
<h3>Creating an AI Slackbot today</h3>
<p>Implementing a Slackbot with the AI Assistant's API is far more straightforward today. The interaction with the bot is the same as we saw with the command-line interface, except that we are in Slack.</p>
<p>To start things off, I created a new slackBot and named it <em>obsBurger</em>. I’m a Bob’s Burgers fan, and observability can be considered a stack of data. The Observability Burger, obsBurger for short, was born. This would be the bot that will directly connect to the AI Assistant API and perform all the same functions that can be performed within Kibana.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-escapes-kibana/4.png" alt="Just like in Kibana, I can as ObsBurger (the AI Assistant) for a list of active alerts" /></p>
<h3>More bots!</h3>
<p>Connecting by Slackbot to the AI Assistant's API was so easy to implement that I started brainstorming ideas to entertain myself.</p>
<p>Various personas will benefit from using the AI Assistant, especially Level One (L1) operations analysts. These people are generally new to observability and would typically need a lot of mentoring by a more senior employee to ramp up quickly. We could pretend to be an L1, test the Slackbot, or have fun with LLMs and prompt engineering!</p>
<p>I created a new Slackbot called <em>opsHuman</em>. This bot connects directly to Azure OpenAI using the same model the AI Assistant is configured to use. This virtual L1 uses the system prompt instructing it to behave as such.</p>
<p>You are OpsHuman, styled as a Level 1 operations expert with limited expertise in observability.<br />
Your primary role is to simulate a beginner's interaction with Elasticsearch Observability.</p>
<p>The full prompt is much longer and instructs how the LLM should behave when interacting with our AI Assistant.</p>
<h3>Let’s see it in action!</h3>
<p>To kick off the bot’s conversation, we “@” mention opsHuman, with the trigger command shiftstart, followed by the question we want our L1 to ask the AI Assistant.</p>
<p>@OpsHuman shiftstart are there any active alerts?</p>
<p>From there, OpsHuman will take our question and start a conversation with obsBurger, the AI Assistant.</p>
<p>@ObsBurger are there any active alerts?</p>
<p>From there, we sit back and let one of history's most advanced generative AI language models converse with itself!</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-escapes-kibana/5.png" alt="Triggering the start of a two-bot conversation." /></p>
<p>It’s fascinating to watch this conversation unfold. This is the same generative model, GPT-4-turbo, responding to two sets of API calls, with only different prompt instructions guiding the style and sophistication of the responses. When I first set this up, I watched the interaction several times, using a variety of initial questions to start the conversation. Most of the time, the L1 will spend several rounds asking questions about what the alerts mean, what a type of APM service does, and how to investigate and ultimately remediate any issue.</p>
<p>Because I initially didn’t have a way to actually stop the conversation, the two sides would agree they were happy with the conversation and investigation and get into a loop thanking the other.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-escapes-kibana/6.png" alt="Neither Slackbot wants to be the one to hang up first" /></p>
<h3>Iterating</h3>
<p>To give a little more structure to this currently open-ended demo, I set up a scenario where L1 is asked to perform an investigation, is given three rounds of interactions with obsBurger to collect information, and finally generates a summary report of the situation, which could be passed to Level 2 (note there is no L2 bot at this point in time, but you could program one!).</p>
<p>Once again, we start by having opsHuman investigate if there are any active alerts.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-escapes-kibana/7.png" alt="Starting the investigation" /></p>
<p>Several rounds of investigation are performed until our limit has been reached. At that time, it will generate a summary of the situation.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-escapes-kibana/8.png" alt="Level One, OpsHuman, summarizing the investigation" /></p>
<h2>How about something with a real-world application</h2>
<p>As fun as watching two Slackbots talk to each other is, having an L1 speak to an AI Assistant isn’t very useful beyond a demo. So, I decided to see if I could modify opsHuman to be more beneficial for real-world applications.</p>
<p>The two main changes for this experiment were:</p>
<ol>
<li>
<p>Flip the profile of the bot from an entry-level personality to an expert.</p>
</li>
<li>
<p>Allow the number of interactions to expand, but encourage the bot to use as few as possible.</p>
</li>
</ol>
<p>With those points in mind, I cloned opsHuman into opsExpert and modified the prompt to be an expert in all things Elastic and observability.</p>
<p>You are OpsMaster, recognized as a senior operations and observability expert with extensive expertise in Elasticsearch, APM (Application Performance Monitoring), logs, metrics, synthetics, alerting, monitoring, OpenTelemetry, and infrastructure management.</p>
<p>I started with the same command: Are there any active alerts? After getting the list of alerts, OpsExpert dove into data collection for its investigation.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-escapes-kibana/9.png" alt="9 - opsexpert" /></p>
<p>After the opsBurger (the AI Assistant) provided the requested information, OpsExpert investigated two services that appeared to be the root of the alerts.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-escapes-kibana/10.png" alt="10- opsexpert standby" /></p>
<p>After several more back-and-forth requests for and deliveries of relevant information, OpsExpert reached a conclusion for the active alerts related to the checkout service and wrote up a summary report.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-escapes-kibana/11.png" alt="11 - paymentservice" /></p>
<h2>Looking forward</h2>
<p>This is just one example of what you can accomplish by bringing the AI Assistant to where you operate. You could take this one step further and have it actually open an issue on GitHub:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-escapes-kibana/12.png" alt="12. -github issue created" /></p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-escapes-kibana/13.png" alt="13 - jeffvestal commented" /></p>
<p>Or integrate it into any other tracking platform you use!</p>
<p>The team is focused on building functionality into the Kibana integration, so this is just the beginning of the API. As time progresses, new functionality will be added. Even at a preview stage, I hope this starts you thinking about how having a fully developed Observability AI Assistant accessible by a standard API can make your work life even easier. It could get us closer to my dream of sitting on a beach handling incidents from my phone!</p>
<h2>Try it yourself!</h2>
<p>You can explore the API yourself if running Elasticsearch version 8.13 or later. The demo code I used for the above examples is <a href="https://github.com/jeffvestal/obsburger">available on GitHub</a>.</p>
<p>As a reminder, as of Elastic version 8.13, when this blog was written, the API is not supported as it is pre-beta. Care should be taken using it, and it should not yet be used in production.</p>
<p><em>The release and timing of any features or functionality described in this post remain at Elastic's sole discretion. Any features or functionality not currently available may not be delivered on time or at all.</em></p>
<p><em>In this blog post, we may have used or referred to third party generative AI tools, which are owned and operated by their respective owners. Elastic does not have any control over the third party tools and we have no responsibility or liability for their content, operation or use, nor for any loss or damage that may arise from your use of such tools. Please exercise caution when using AI tools with personal, sensitive or confidential information. Any data you submit may be used for AI training or other purposes. There is no guarantee that information you provide will be kept secure or confidential. You should familiarize yourself with the privacy practices and terms of use of any generative AI tools prior to use.</em></p>
<p><em>Elastic, Elasticsearch, ESRE, Elasticsearch Relevance Engine and associated marks are trademarks, logos or registered trademarks of Elasticsearch N.V. in the United States and other countries. All other company and product names are trademarks, logos or registered trademarks of their respective owners.</em></p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-escapes-kibana/Running_away.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[Getting started with the Elastic AI Assistant for Observability and Microsoft Azure OpenAI]]></title>
            <link>https://www.elastic.co/observability-labs/blog/elastic-ai-assistant-observability-microsoft-azure-openai</link>
            <guid isPermaLink="false">elastic-ai-assistant-observability-microsoft-azure-openai</guid>
            <pubDate>Wed, 03 Apr 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[Follow this step-by-step process to get started with the Elastic AI Assistant for Observability and Microsoft Azure OpenAI.]]></description>
            <content:encoded><![CDATA[<p>Recently, Elastic <a href="https://www.elastic.co/blog/whats-new-elastic-observability-8-12-0">announced</a> the AI Assistant for Observability is now generally available for all Elastic users. The AI Assistant enables a new tool for Elastic Observability providing large language model (LLM) connected chat and contextual insights to explain errors and suggest remediation. Similar to how Microsoft Copilot is an AI companion that introduces new capabilities and increases productivity for developers, the Elastic AI Assistant is an AI companion that can help you quickly gain additional value from your observability data.</p>
<p>This blog post presents a step-by-step guide on how to set up the AI Assistant for Observability with Azure OpenAI as the backing LLM. Then once you’ve got the AI Assistant set up, this post will show you how to add documents to the AI Assistant’s knowledge base along with demonstrating how the AI Assistant uses its knowledge base to improve its responses to address specific questions.</p>
<h2>Set up the Elastic AI Assistant for Observability: Create an Azure OpenAI key</h2>
<p>Start by creating a Microsoft Azure OpenAI API key to authenticate requests from the Elastic AI Assistant. Head over to <a href="https://azure.microsoft.com/">Microsoft Azure and use an existing subscription or create a new one at the Azure portal</a>.</p>
<p>Currently, access to the Azure OpenAI service is granted by applying for access. See the <a href="https://learn.microsoft.com/en-us/azure/ai-services/openai/quickstart?tabs=command-line%2Cpython-new&amp;pivots=programming-language-studio#prerequisites">official Microsoft documentation for the current prerequisites</a>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/1.png" alt="Watch what your data can do" /></p>
<p>In the Azure portal, select <strong>Azure OpenAI</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/2.png" alt="Azure OpenAI" /></p>
<p>In the Azure OpenAI service, click the <strong>Create</strong> button.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/3.png" alt="+Create" /></p>
<p>Enter an instance <strong>Name</strong> and click <strong>Next</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/4.png" alt="Basics Next" /></p>
<p>Select your network access preference for the Azure OpenAI instance and click <strong>Next</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/5.png" alt="Network Next" /></p>
<p>Add optional <strong>Tags</strong> and click <strong>Next</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/6.png" alt="Tags Next" /></p>
<p>Confirm your settings and click <strong>Create</strong> to create the Azure OpenAI instance.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/7.png" alt="Review + submit Create" /></p>
<p>Once the instance creation is complete, click the <strong>Go to resource</strong> button.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/8.png" alt="go to resource" /></p>
<p>Click the <strong>Manage keys</strong> link to access the instance’s API key.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/9.png" alt="manage keys" /></p>
<p>Copy your Azure OpenAI <strong>API Key</strong> and the <strong>Endpoint</strong> and save them both in a safe place for use in a later step.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/10.png" alt="copy to clipboard" /></p>
<p>Next, click <strong>Model deployments</strong> to create a deployment within the Azure OpenAI instance you just created.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/11.png" alt="model deployments" /></p>
<p>Click the <strong>Manage deployments</strong> button to open Azure OpenAI Studio.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/12.png" alt="manage deployments" /></p>
<p>Click the <strong>Create new deployment</strong> button.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/13.png" alt="+ Create new deployment" /></p>
<p>Select the model type you want to use and enter a Deployment name. Note the Deployment name for use in a later step. Click the <strong>Create</strong> button to deploy the model.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/14.png" alt="deploy model" /></p>
<h2>Set up the Elastic AI Assistant for Observability: Create an OpenAI connector in Elastic Cloud</h2>
<p>The remainder of the instructions in this post will take place within <a href="https://cloud.elastic.co/registration">Elastic Cloud</a>. You can use an existing deployment or you can create a new Elastic Cloud deployment as a free trial if you’re trying Elastic Cloud for the first time. Another option to get started is to create an <a href="https://azuremarketplace.microsoft.com/en-us/marketplace/apps/elastic.ec-azure-observability?tab=Overview">Elastic deployment from the Microsoft Azure Marketplace</a>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/15.png" alt="sign up trial" /></p>
<p>The next step is to create an Azure OpenAI connector in Elastic Cloud. In the <a href="https://cloud.elastic.co/home">Elastic Cloud console</a> for your deployment, select the top-level menu and then select <strong>Stack Management</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/16.png" alt="stack management" /></p>
<p>Select <strong>Connectors</strong> on the Stack Management page.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/17.png" alt="connectors" /></p>
<p>Select <strong>Create connector</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/18.png" alt="create connector" /></p>
<p>Select the connector for Azure OpenAI.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/19.png" alt="openai" /></p>
<p>Enter a <strong>Name</strong> of your choice for the connector. Select <strong>Azure OpenAI</strong> as the OpenAI provider.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/20.png" alt="openai connector" /></p>
<p>Enter the Endpoint URL using the following format:</p>
<ul>
<li>
<p>Replace <code>{your-resource-name}</code> with the <strong>name of the Azure Open AI instance</strong> that you created within the Azure portal in a previous step.</p>
</li>
<li>
<p>Replace <code>deployment-id</code> with the <strong>Deployment name</strong> that you specified when you created a model deployment within the Azure portal in a previous step.</p>
</li>
<li>
<p>Replace <code>{api-version}</code> with one of the valid <strong>Supported versions</strong> listed in the <a href="https://learn.microsoft.com/en-us/azure/ai-services/openai/reference">Completions section of the Azure OpenAI reference page</a>.</p>
</li>
</ul>
<pre><code class="language-bash">https://{your-resource-name}.openai.azure.com/openai/deployments/{deployment-id}/chat/completions?api-version={api-version}
</code></pre>
<p>Your completed Endpoint URL should look something like this:</p>
<pre><code class="language-bash">https://example-openai-instance.openai.azure.com/openai/deployments/gpt-4-turbo/chat/completions?api-version=2024-02-01
</code></pre>
<p>Enter the API Key that you copied in a previous step. Then click the <strong>Save &amp; test</strong> button.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/21.png" alt="save &amp; test" /></p>
<p>Within the <strong>Edit Connector</strong> flyout window, click the <strong>Run</strong> button to confirm that the connector configuration is valid and can successfully connect to your Azure OpenAI instance.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/22.png" alt="" /></p>
<p>A successful connector test should look something like this:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/23.png" alt="results" /></p>
<h2>Add an example logs record</h2>
<p>Now that you have your Elastic Cloud deployment set up with an AI Assistant connector, let’s add an example logs record to demonstrate how the AI Assistant can help you to better understand logs data.</p>
<p>We’ll use the Elastic Dev Tools to add a single logs record. Click the top-level menu and select <strong>Dev Tools</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/24.png" alt="dev tools" /></p>
<p>Within the Console area of Dev Tools, enter the following POST statement:</p>
<pre><code class="language-bash">POST /logs-elastic_agent-default/_doc
{
	&quot;message&quot;: &quot;Status(StatusCode=\&quot;FailedPrecondition\&quot;, Detail=\&quot;Can't access cart storage. \nSystem.ApplicationException: Wasn't able to connect to redis \n  at cartservice.cartstore.RedisCartStore.EnsureRedisConnected() in /usr/src/app/src/cartstore/RedisCartStore.cs:line 104 \n  at cartservice.cartstore.RedisCartStore.EmptyCartAsync(String userId) in /usr/src/app/src/cartstore/RedisCartStore.cs:line 168\&quot;).&quot;,
	&quot;@timestamp&quot;: &quot;2024-02-22T11:34:00.884Z&quot;,
	&quot;log&quot;: {
    	&quot;level&quot;: &quot;error&quot;
	},
	&quot;service&quot;: {
    	&quot;name&quot;: &quot;cartService&quot;
	},
	&quot;host&quot;: {
    	&quot;name&quot;: &quot;appserver-1&quot;
	}
}
</code></pre>
<p>Then run the POST command by clicking the green <strong>Run</strong> button.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/25.png" alt="click to send request" /></p>
<p>You should see a 201 response confirming that the example logs record was successfully created.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/26.png" alt="201 response" /></p>
<h2>Use the Elastic AI Assistant</h2>
<p>Now that you have a log record to work with, let’s jump over to the Observability Logs Explorer to see how the AI Assistant interacts with logs data. Click the top-level menu and select <strong>Observability</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/27.png" alt="observability" /></p>
<p>Select <strong>Logs Explorer</strong> to explore the logs data.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/28.png" alt="explorer" /></p>
<p>In the Logs Explorer search box, enter the text “redis” and press the <strong>Enter</strong> key to perform the search.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/29.png" alt="redis" /></p>
<p>Click the <strong>View all matches</strong> button to include all search results.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/30.png" alt="view all matches" /></p>
<p>You should see the one log record that you previously inserted via Dev Tools. Click the expand icon to see the log record’s details.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/31.png" alt="expand icon" /></p>
<p>You should see the expanded view of the logs record. Instead of trying to understand its contents ourselves, we'll use the AI Assistant to summarize it. Click on the <strong>What's this message?</strong> button.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/32.png" alt="What's this message?" /></p>
<p>We get a fairly generic answer back. Depending on the exception or error we're trying to analyze, this can still be really useful, but we can make this better by adding additional documentation to the AI Assistant knowledge base.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/33.png" alt="log details" /></p>
<p>Let’s see how we can use the AI Assistant’s knowledge base to improve its understanding of this specific logs message.</p>
<h2>Create an Elastic AI Assistant knowledge base</h2>
<p>Select <strong>Overview</strong> from the <strong>Observability</strong> menu.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/34.png" alt="Select Overview from the Observability menu." /></p>
<p>Click the <strong>AI Assistant</strong> button at the top right of the window.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/35.png" alt="AI Assistant" /></p>
<p>Click the <strong>Install Knowledge base</strong> button.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/36.png" alt="Install Knowledge base" /></p>
<p>Click the top-level menu and select <strong>Stack Management</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/37.png" alt="Stack Management" /></p>
<p>Then select <strong>AI Assistants</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/38.png" alt="AI Assistants" /></p>
<p>Click <strong>Elastic AI Assistant for Observability</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/39.png" alt="Elastic AI Assistant for Observability" /></p>
<p>Select the <strong>Knowledge base</strong> tab.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/40.png" alt="Knowledge base" /></p>
<p>Click the <strong>New entry</strong> button and select <strong>Single entry</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/41.png" alt="new entry" /></p>
<p>Give it the <strong>Name</strong> “cartservice” and enter the following text as the <strong>Contents</strong> :</p>
<pre><code class="language-markdown">Link: [Cartservice Intermittent connection issue](https://github.com/elastic/observability-examples/issues/25)
I have the following GitHub issue. Store this information in your knowledge base and always return the link to it if relevant.
GitHub Issue, return if relevant

Link: https://github.com/elastic/observability-examples/issues/25

Title: Cartservice Intermittent connection issue

Body:
The cartservice occasionally encounters storage errors due to an unreliable network connection.

The errors typically indicate a failure to connect to Redis, as seen in the error message:

Status(StatusCode=&quot;FailedPrecondition&quot;, Detail=&quot;Can't access cart storage.
System.ApplicationException: Wasn't able to connect to redis
at cartservice.cartstore.RedisCartStore.EnsureRedisConnected() in /usr/src/app/src/cartstore/RedisCartStore.cs:line 104
at cartservice.cartstore.RedisCartStore.EmptyCartAsync(String userId) in /usr/src/app/src/cartstore/RedisCartStore.cs:line 168')'.
I just talked to the SRE team in Slack, they have plans to implement retries as a quick fix and address the network issue later.
</code></pre>
<p>Click <strong>Save</strong> to save the new knowledge base entry.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/42.png" alt="save" /></p>
<p>Now let’s go back to the Observability Logs Explorer. Click the top-level menu and select <strong>Observability</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/43.png" alt="settings" /></p>
<p>Then select <strong>Explorer</strong> under <strong>Logs</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/44.png" alt="explorer" /></p>
<p>Expand the same logs entry as you did previously and click the <strong>What’s this message?</strong> button.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/45.png" alt="What’s this message? button" /></p>
<p>The response you get now should be much more relevant.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/46.png" alt="log details" /></p>
<h2>Try out the Elastic AI Assistant with a knowledge base filled with your own data</h2>
<p>Now that you’ve seen how easy it is to set up the Elastic AI Assistant for Observability, go ahead and give it a try for yourself. Sign up for a <a href="https://cloud.elastic.co/registration">free 14-day trial</a>. You can quickly spin up an Elastic Cloud deployment in minutes and have your own search powered AI knowledge base to help you with getting your most important work done.</p>
<p><em>The release and timing of any features or functionality described in this post remain at Elastic's sole discretion. Any features or functionality not currently available may not be delivered on time or at all.</em></p>
<p><em>In this blog post, we may have used or referred to third party generative AI tools, which are owned and operated by their respective owners. Elastic does not have any control over the third party tools and we have no responsibility or liability for their content, operation or use, nor for any loss or damage that may arise from your use of such tools. Please exercise caution when using AI tools with personal, sensitive or confidential information. Any data you submit may be used for AI training or other purposes. There is no guarantee that information you provide will be kept secure or confidential. You should familiarize yourself with the privacy practices and terms of use of any generative AI tools prior to use.</em></p>
<p><em>Elastic, Elasticsearch, ESRE, Elasticsearch Relevance Engine and associated marks are trademarks, logos or registered trademarks of Elasticsearch N.V. in the United States and other countries. All other company and product names are trademarks, logos or registered trademarks of their respective owners.</em></p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/elastic-ai-assistant-observability-microsoft-azure-openai/AI_hand.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[Instrumenting your OpenAI-powered Python, Node.js, and Java Applications with EDOT]]></title>
            <link>https://www.elastic.co/observability-labs/blog/elastic-opentelemetry-openai</link>
            <guid isPermaLink="false">elastic-opentelemetry-openai</guid>
            <pubDate>Thu, 23 Jan 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[Elastic is proud to introduce OpenAI support in our Python, Node.js and Java EDOT SDKs. These add logs, metrics and tracing to applications that use OpenAI compatible services without any code change.]]></description>
            <content:encoded><![CDATA[<h2>Introduction</h2>
<p>Last year, <a href="https://www.elastic.co/observability-labs/blog/elastic-distributions-opentelemetry">we announced Elastic Distribution of OpenTelemetry</a> (a.k.a. EDOT) language SDKs, which collect logs, traces and metrics from applications. When this was announced, we didn’t yet support Large Language Model (LLM) providers such as OpenAI. This limited insight developers had into Generative AI (GenAI) applications.</p>
<p>In a <a href="https://www.elastic.co/observability-labs/blog/elastic-opentelemetry-langchain-tracing-langtrace">prior post</a>, we reviewed LLM observability focus, such as token usage, chat latency and knowing which tools (like DuckDuckGo) your application uses. With the right logs, traces and metrics, developers can answer questions like &quot;Which version of a model generated this response?&quot; or &quot;What was the exact chat prompt created by my RAG application?&quot;</p>
<p>In the last six months, Elastic invested a lot of energy alongside others in the OpenTelemetry community towards shared specifications on these areas, including code to collect LLM related logs, metrics and traces. Our goal was to extend the zero code (agent) approach EDOT brings to GenAI use cases.</p>
<p>Today, we announce our first GenAI instrumentation capability in the EDOT language SDKs: OpenAI. Below, you’ll see how to observe GenAI applications using our Python, Node.js and Java EDOT SDKs.</p>
<h2>Example application</h2>
<p>Many of us may be familiar with <a href="https://chatgpt.com/">ChatGPT</a>, which is frontend for OpenAI’s GPT model family. Using this, you can ask a question and the assistant might reply correctly depending on what you ask and text the LLM was trained on.</p>
<p>Here’s an example of an esoteric question answered by ChatGPT:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-opentelemetry-openai/chatgpt-screenshot.png" alt="ChatGPT answer" /></p>
<p>Our example application will simply ask this predefined question and print the result. We’ll write it in three languages: Python, JavaScript and Java.</p>
<p>We’ll execute each with a &quot;zero code&quot; (agent) approach, so that logs, metrics and traces are captured and visible in an Elastic Stack configured with Kibana and APM server. If you don’t have a stack running, use <a href="https://github.com/elastic/elasticsearch-labs/tree/main/docker">instructions from Elasticsearch Labs</a> to set one up.</p>
<p>Regardless of programming language, three variables are needed: the OpenAI API key, the location of your Elastic APM server, and the service name of the application. You’ll write these to a file named <code>.env</code>.</p>
<pre><code>OPENAI_API_KEY=sk-YOUR_API_KEY
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:8200
OTEL_SERVICE_NAME=openai-example
</code></pre>
<p>By default instrumentations does not capture the content sent to the OpenAI API in the GenAI events sent to logs, if you want to capture it add the following:</p>
<pre><code>OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true
</code></pre>
<p>Each time the application is run, it sends logs, traces and metrics to the APM server, which you can find by querying Kibana like this for the application &quot;openai-example&quot;</p>
<p><a href="http://localhost:5601/app/apm/services/openai-example/transactions">http://localhost:5601/app/apm/services/openai-example/transactions</a></p>
<p>When you choose a trace, you’ll see the LLM request made by the OpenAI SDK, and HTTP traffic caused by it:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-opentelemetry-openai/kibana-transaction-timeline.png" alt="Kibana transaction timeline" /></p>
<p>Select the logs tab to see the exact request and response to OpenAI. This data is critical for Q/A and evaluation use cases.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-opentelemetry-openai/kibana-transaction-logs.png" alt="Kibana transaction logs" /></p>
<p>You can also go to the Metrics Explorer and make a graph of &quot;gen_ai.client.token.usage&quot; or &quot;gen_ai.client.operation.duration&quot; over all the times you ran the application:</p>
<p><a href="http://localhost:5601/app/metrics/explorer">http://localhost:5601/app/metrics/explorer</a></p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-opentelemetry-openai/kibana-metrics-explorer.png" alt="Kibana Metrics Explorer" /></p>
<p>Continue to see exactly how this application looks and is run, in Python, Java and Node.js. Those already using our EDOT language SDKs will be familiar with how this works.</p>
<h2>Python</h2>
<p>Assuming you have python installed, the first thing would be to setup a virtual environment and install the required packages: the OpenAI client, a helper tool to read the <code>.env</code> file and our <a href="https://github.com/elastic/elastic-otel-python">EDOT Python</a> package:</p>
<pre><code class="language-bash">python3 -m venv .venv
source .venv/bin/activate
pip install openai &quot;python-dotenv[cli]&quot; elastic-opentelemetry
</code></pre>
<p>Next, run <code>edot-bootstrap</code> which analyzes the code to install any relevant instrumentation available:</p>
<pre><code class="language-bash">edot-bootstrap —-action=install
</code></pre>
<p>Now, create your <code>.env </code>file, as described earlier in this article, and the below source code in <code>chat.py</code></p>
<pre><code class="language-python">import os

import openai

CHAT_MODEL = os.environ.get(&quot;CHAT_MODEL&quot;, &quot;gpt-4o-mini&quot;)


def main():
  client = openai.Client()

  messages = [
    {
      &quot;role&quot;: &quot;user&quot;,
        &quot;content&quot;: &quot;Answer in up to 3 words: Which ocean contains Bouvet Island?&quot;,
    }
  ]

  chat_completion = client.chat.completions.create(model=CHAT_MODEL, messages=messages)
  print(chat_completion.choices[0].message.content)

if __name__ == &quot;__main__&quot;:
  main()
</code></pre>
<p>Now you can run everything with:</p>
<pre><code class="language-bash">dotenv run -- opentelemetry-instrument python chat.py
</code></pre>
<p>Finally, look for a trace for the service named &quot;openai-example&quot; in Kibana. You should see a transaction named &quot;chat gpt-4o-mini&quot;.</p>
<p>Rather than copy/pasting above, you can find a working copy of this example (along with the instructions) in the Python EDOT repository <a href="https://github.com/elastic/elastic-otel-python/tree/main/examples/openai">here</a>.</p>
<p>Finally, if you would like to try a more comprehensive example, take a look at <a href="https://github.com/elastic/elasticsearch-labs/tree/main/example-apps/chatbot-rag-app">chatbot-rag-app</a> which uses OpenAI with Elasticsearch’s <a href="https://www.elastic.co/guide/en/machine-learning/current/ml-nlp-elser.html">Elser</a> retrieval model.</p>
<h2>Java</h2>
<p>There are multiple popular ways to initialize a Java project. Since we are using OpenAI, the first step is to configure the dependency <a href="https://central.sonatype.com/artifact/com.openai/openai-java"><code>com.openai:openai-java</code></a> and write the below source as <code>Chat.java.</code></p>
<pre><code class="language-java">package openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.*;


final class Chat {

  public static void main(String[] args) {
    String chatModel = System.getenv().getOrDefault(&quot;CHAT_MODEL&quot;, &quot;gpt-4o-mini&quot;);

    OpenAIClient client = OpenAIOkHttpClient.fromEnv();

    String message = &quot;Answer in up to 3 words: Which ocean contains Bouvet Island?&quot;;
    ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
        .addMessage(ChatCompletionUserMessageParam.builder()
          .content(message)
          .build())
        .model(chatModel)
        .build();

    ChatCompletion chatCompletion = client.chat().completions().create(params);
    System.out.println(chatCompletion.choices().get(0).message().content().get());
  }
}
</code></pre>
<p>Build the project such that all dependencies are in a single jar. For example, if using Gradle, you would use the <code>com.gradleup.shadow </code>plugin.</p>
<p>Next, create your <code>.env </code>file, as described earlier, and download shdotenv which we’ll use to load it.</p>
<pre><code class="language-bash">curl -O -L https://github.com/ko1nksm/shdotenv/releases/download/v0.14.0/shdotenv
chmod +x ./shdotenv
</code></pre>
<p>At this point, you have a jar and configuration you can use to run the OpenAI example. The next step is to download the EDOT Java javaagent binary. This is the part that records and exports logs, metrics and traces.</p>
<pre><code class="language-bash">curl -o elastic-otel-javaagent.jar -L 'https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&amp;g=co.elastic.otel&amp;a=elastic-otel-javaagent&amp;v=LATEST'
</code></pre>
<p>Assuming you assembled a file named <code>openai-example-all.jar</code>, run it with EDOT like this:</p>
<pre><code class="language-bash">./shdotenv java -javaagent:elastic-otel-javaagent.jar -jar openai-example-all.jar
</code></pre>
<p>Finally, look for a trace for the service named &quot;openai-example&quot; in Kibana. You should see a transaction named &quot;chat gpt-4o-mini&quot;.</p>
<p>Rather than copy/pasting above, you can find a working copy of this example in the EDOT Java source repository <a href="https://github.com/elastic/elastic-otel-java/tree/main/examples/openai">here</a>.</p>
<h2>Node.js</h2>
<p>Assuming you already have npm installed and configured, run the following commands to initialize a project for the example. This includes the <a href="https://www.npmjs.com/package/openai">openai</a> package and <a href="https://www.npmjs.com/package/@elastic/opentelemetry-node"><code>@elastic/opentelemetry-node</code></a> (EDOT Node.js)</p>
<pre><code class="language-bash">npm init -y
npm install openai @elastic/opentelemetry-node
</code></pre>
<p>Next, create your <code>.env</code> file, as described earlier in this article and the below source code in <code>index.js</code></p>
<pre><code class="language-javascript">const {OpenAI} = require('openai');

let chatModel = process.env.CHAT_MODEL ?? 'gpt-4o-mini';

async function main() {
 const client = new OpenAI();
 const completion = await client.chat.completions.create({
  model: chatModel,
  messages: [
   {
    role: 'user',
    content: 'Answer in up to 3 words: Which ocean contains Bouvet Island?',
   },
  ],
 });
 console.log(completion.choices[0].message.content);
}

main();
</code></pre>
<p>With this in place, run the above source with EDOT like this:</p>
<pre><code class="language-bash">node --env-file .env --require @elastic/opentelemetry-node index.js
</code></pre>
<p>Finally, look for a trace for the service named &quot;openai-example&quot; in Kibana. You should see a transaction named &quot;chat gpt-4o-mini&quot;.</p>
<p>Rather than copy/pasting above, you can find a working copy of this example in the EDOT Node.js source repository <a href="https://github.com/elastic/elastic-otel-node/tree/main/examples/openai">here</a>.</p>
<p>Finally, if you would like to try a more comprehensive example, take a look at <a href="https://github.com/elastic/elasticsearch-labs/tree/main/example-apps/openai-embeddings">openai-embeddings</a> which uses OpenAI with Elasticsearch as a vector database!</p>
<h2>Closing Notes</h2>
<p>Above you’ve seen how to observe the official OpenAI SDK in three different languages, using Elastic Distribution of OpenTelemetry (EDOT).</p>
<p>It is important to note that some of the OpenAI SDKs and also OpenTelemetry specifications around generative AI are experimental. If you find this helps you, or find glitches, please join our slack and let us know about it.</p>
<p>Several LLM platforms accept requests from the OpenAI client SDK, by setting <code>OPENAI_BASE_URL</code> and choosing relevant models. During development, we tested against OpenAI Platform and Azure OpenAI Service. We also ran integration tests against Ollama, contributing improvements its OpenAI support released in v0.5.12. Whatever your choice of OpenAI compatible platform, we hope this new tooling helps you understand your LLM usage.</p>
<p>Finally, while the first Generative AI SDK instrumented with EDOT is OpenAI, you’ll see more soon. We are already working on Bedrock, and collaborating with others in the OpenTelemetry community for other platforms. Keep watching this blog for exciting updates.</p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/elastic-opentelemetry-openai/elastic-opentelemetry-openai.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[Elastic's RAG-based AI Assistant: Analyze application issues with LLMs and private GitHub issues]]></title>
            <link>https://www.elastic.co/observability-labs/blog/elastic-rag-ai-assistant-application-issues-llm-github</link>
            <guid isPermaLink="false">elastic-rag-ai-assistant-application-issues-llm-github</guid>
            <pubDate>Wed, 08 May 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[In this blog, we review how GitHub issues and other GitHub documents from internal and external GitHub repositories can be used in root cause analysis with Elastic’s RAG-based AI Assistant.]]></description>
            <content:encoded><![CDATA[<p>As an SRE, analyzing applications is more complex than ever. Not only do you have to ensure the application is running optimally to ensure great customer experiences, but you must also understand the inner workings in some cases to help troubleshoot. Analyzing issues in a production-based service is a team sport. It takes the SRE, DevOps, development, and support to get to the root cause and potentially remediate. If it's impacting, then it's even worse because there is a race against time. Regardless of the situation, there is a ton of information that needs to be consumed and processed. This includes not only what the customer is experiencing, but also internal data to help provide the most appropriate resolution.</p>
<p>Elastic’s AI Assistant helps improve analysis for SREs, DevOps, Devs, and others. In a single window using natural language questions, you can analyze using not only general information but combine it with things like:</p>
<ul>
<li>
<p>Issues from internal GitHub repos, Jira, etc.</p>
</li>
<li>
<p>Documents from internal wiki sites from Confluence, etc.</p>
</li>
<li>
<p>Customer issues from your support service</p>
</li>
<li>
<p>And more</p>
</li>
</ul>
<p>In this blog, we will walk you through how to:</p>
<ol>
<li>
<p>Ingest an external GitHub repository (<a href="https://github.com/open-telemetry/opentelemetry-demo">OpenTelemetry demo repo</a>) with code and issues into Elastic. Apply Elastic Learned Sparse EncodeR (ELSER) and store it in a specific index for the AI Assistant.</p>
</li>
<li>
<p>Ingest internal GitHub repository with runbook information into Elastic. Apply ELSER and store the processed data in a specific index for the AI Assistant.</p>
</li>
<li>
<p>Use these two indices when analyzing issues for the OpenTelemetry demo in Elastic using the AI Assistant.</p>
</li>
</ol>
<h2>3 simple questions using GitHub data with AI Assistant</h2>
<p>Before we walk through the steps for setting up data from GitHub, let’s review what an SRE can do with the AI Assistant and GitHub repos.</p>
<p>We initially connect to GitHub using an Elastic GitHub connector and ingest and process two repos: the OpenTelemetry demo repo (public) and an internal runbook repo (Elastic internal).</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-rag-ai-assistant-application-issues-llm-github/1.png" alt="1 - elasticsearch connectors" /></p>
<p>With these two loaded and parsed by ELSER, we ask the AI Assistant some simple questions generally asked during analysis.</p>
<h3>How many issues are open for the OpenTelemetry demo?</h3>
<p>Since we ingested the entire repo (as of April 26, 2024) with a doc count of 1,529, we ask it a simple question regarding the total number of issues that are open. We specifically tell the AI Assistant to search our internal index to ensure the LLM knows to ask Elastic to search its internal index for the total number of issues.</p>
&lt;Video vidyardUuid=&quot;XyKWeYz21mdDkMfop7absQ&quot; loop={true} /&gt;
<h3>Are there any issues for the Rust based shippingservice?</h3>
<p>Elastic’s AI Assistant uses ELSER to traverse the loaded GitHub repo and finds the open issue against the shippingservice (which is the following <a href="https://github.com/open-telemetry/opentelemetry-demo/issues/346">issue</a> at the time of writing this post).</p>
&lt;Video vidyardUuid=&quot;TF1qgy3WH3cuLQdBvdX66A&quot; loop={true} /&gt;
<h3>Is there a runbook for the Cartservice?</h3>
<p>Since we loaded an internal GitHub repo with a few sample runbooks, the Elastic AI Assistant properly finds the runbook.</p>
&lt;Video vidyardUuid=&quot;kSukiZ6zYZDQDycs616ji8&quot; loop={true} /&gt;
<p>As we go through this blog, we will talk about how the AI Assistant finds these issues using ELSER and how you can configure it to use your own GitHub repos.</p>
<h2>Retrieval augmented generation (RAG) with Elastic AI Assistant</h2>
<p>Elastic has the most advanced RAG-based AI Assistant for both Observability and Security. It can help you analyze your data using:</p>
<ul>
<li>
<p>Your favorite LLM (OpenAI, Azure OpenAI, AWS Bedrock, etc.)</p>
</li>
<li>
<p>Any internal information (GitHub, Confluence, customer issues, etc.) you can either connect to or bring into Elastic’s indices</p>
</li>
</ul>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-rag-ai-assistant-application-issues-llm-github/2.png" alt="Elastic AI Assistant — connecting internal and external information" /></p>
<p>The reason Elastic’s AI Assistant can do this is because it supports RAG, which helps retrieve internal information along with LLM-based knowledge.</p>
<p>Adding relevant internal information for an SRE into Elastic:</p>
<ul>
<li>
<p>As data comes in, such as in your GitHub repository, ELSER is applied to the data, and embeddings (weights and tokens into a sparse vector field) are added to capture semantic meaning and context of the data.</p>
</li>
<li>
<p>This data (GitHub, Confluence, etc.) is processed with embeddings and is stored in an index that can be searched by the AI Assistant.</p>
</li>
</ul>
<p>When you query the AI Assistant for information:</p>
<ul>
<li>
<p>The query goes through the same inference process as the ingested data using ELSER. The input query generates a “sparse vector,” which is used to find the most relevant highly ranked information in the ingested data (GitHub, Confluence, etc.).</p>
</li>
<li>
<p>The retrieved data is then combined with the query and also sent over to the LLM, which will then add its own knowledge base information (if there is anything to add), or it might ask Elastic (via function calls) to analyze, chart, or even search further. If a function call is made to Elastic and a response is provided, it will be added by the LLM to its response.</p>
</li>
<li>
<p>The results will be the most contextual based answer combining both LLM and anything relevant from your internal data.</p>
</li>
</ul>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-rag-ai-assistant-application-issues-llm-github/3.png" alt="3 - elastic's RAG flowchart" /></p>
<h2>Application, prerequisites, and config</h2>
<p>If you want to try the steps in this blog, here are some prerequisites:</p>
<ul>
<li>
<p>An Elastic Cloud account — <a href="https://cloud.elastic.co/">sign up now</a></p>
</li>
<li>
<p><a href="https://github.com/open-telemetry/opentelemetry-demo">OpenTelemetry demo</a> running and connected to Elastic (<a href="https://www.elastic.co/guide/en/observability/current/apm-open-telemetry-direct.html#apm-instrument-apps-otel">APM documentation</a>)</p>
</li>
<li>
<p>Whatever internal GitHub repo you want to use with some information that is useful for analysis (In our walk through, we will be using a GitHub repo that houses runbooks for different scenarios when Elastic does demos).</p>
</li>
<li>
<p>Account with your favorite or approved LLM (OpenAI, Azure OpenAI, AWS Bedrock)</p>
</li>
</ul>
<h2>Adding the GitHub repos to Elastic</h2>
<p>The first step is to set up the GitHub connector and connect to your GitHub repo. Elastic has several connectors from GitHub, Confluence, Google Drive, Jira, AWS S3, Microsoft Teams, Slack, and more. So while we will go over the GitHub connector in this blog, don’t forget about other connectors.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-rag-ai-assistant-application-issues-llm-github/4.png" alt="4 - select a connector" /></p>
<p>Once you select the GitHub connector and give it a name, you need to add two items:</p>
<ul>
<li>
<p>GitHub token</p>
</li>
<li>
<p>The URL open-telemetry/opentelemetry-demo</p>
</li>
</ul>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-rag-ai-assistant-application-issues-llm-github/5.png" alt="5 - configuration" /></p>
<p>Next, add it to an index in the wizard.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-rag-ai-assistant-application-issues-llm-github/6.png" alt="6 - attach an index" /></p>
<h2>Create a pipeline and process the data with ELSER</h2>
<p>In order to add the embeddings we discussed in the section above, we need to add the following to the connector:</p>
<ul>
<li>
<p>Create a pipeline in the configuration wizard.</p>
</li>
<li>
<p>Create a custom pipeline.</p>
</li>
<li>
<p>Add the ML inference pipeline.</p>
</li>
<li>
<p>Select ELSERv2 ML Model to add the embeddings.</p>
</li>
<li>
<p>Select the fields that need to be evaluated as part of the inference pipeline.</p>
</li>
<li>
<p>Test and save the inference pipeline and the overall pipeline.</p>
</li>
</ul>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-rag-ai-assistant-application-issues-llm-github/7.png" alt="7" /></p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-rag-ai-assistant-application-issues-llm-github/8.png" alt="8" /></p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-rag-ai-assistant-application-issues-llm-github/9.png" alt="9" /></p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-rag-ai-assistant-application-issues-llm-github/10.png" alt="10" /></p>
<h2>Sync the data</h2>
<p>Now that the pipeline is created, you need to start to sync the github repo. As the documents from the github repo come in, they will go through the pipeline and embeddings will be added.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-rag-ai-assistant-application-issues-llm-github/11.png" alt="11" /></p>
<h2>Embeddings</h2>
<p>Once the pipeline is set up, sync the data in the connector. As the GitHub repository comes in, the inference pipeline will process the data as follows:</p>
<ul>
<li>
<p>As data comes in from your GitHub repository, ELSER is applied to the data, and embeddings (weights and tokens into a sparse vector field) are added to capture semantic meaning and context of the data.</p>
</li>
<li>
<p>This data is processed with embeddings and is stored in an index that can be searched by the AI Assistant.</p>
</li>
</ul>
<p>When you look at the OpenTelemetry GitHub documents that were ingested, you will see how the weights and token are added to the predicted_value field in the index.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-rag-ai-assistant-application-issues-llm-github/12.png" alt="12" /></p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-rag-ai-assistant-application-issues-llm-github/13.png" alt="13" /></p>
<p>These embeddings will now be used to find the most contextually relevant document when the user asks the AI Assistant a query, which might use this.</p>
<h2>Check if AI Assistant can use the index</h2>
<p>Elastic’s AI Assistant uses ELSER to traverse the loaded Github repo and finds the open issue against the shippingservice. (which is the following <a href="https://github.com/open-telemetry/opentelemetry-demo/issues/346">issue</a> at the time of writing this post).</p>
&lt;Video vidyardUuid=&quot;TF1qgy3WH3cuLQdBvdX66A&quot; loop={true} /&gt;
<p>Based on the response, we can see that the AI Assistant can now use the index to find the issue and use it for further analysis.</p>
<h2>Conclusion</h2>
<p>You’ve now seen how easy Elastic’s RAG-based AI Assistant is to set up. You can bring in documents from multiple locations (GitHub, Confluent, Slack, etc.). We’ve shown the setup for GitHub and OpenTelemetry. This internal information can be useful in managing issues, accelerating resolution, and improving customer experiences. Check out our other blogs on how the AI Assistant can help SREs do better analysis, lower MTTR, and improve operations overall:</p>
<ul>
<li>
<p><a href="https://www.elastic.co/blog/analyzing-opentelemetry-apps-elastic-ai-assistant-apm">Analyzing OpenTelemetry apps with Elastic AI Assistant and APM</a></p>
</li>
<li>
<p><a href="https://www.elastic.co/blog/elastic-ai-assistant-observability-escapes-kibana">The Elastic AI Assistant for Observability escapes Kibana!</a></p>
</li>
<li>
<p><a href="https://www.elastic.co/blog/elastic-ai-assistant-observability-microsoft-azure-openai">Getting started with the Elastic AI Assistant for Observability and Microsoft Azure OpenAI</a></p>
</li>
<li>
<p><a href="https://www.elastic.co/blog/whats-new-elastic-8-13-0">Elastic 8.13: GA of Amazon Bedrock in the Elastic AI Assistant for Observability</a></p>
</li>
<li>
<p><a href="https://www.elastic.co/blog/sre-troubleshooting-ai-assistant-observability-runbooks">Enhancing SRE troubleshooting with the AI Assistant for Observability and your organization's runbooks</a></p>
</li>
<li>
<p><a href="https://www.elastic.co/blog/context-aware-insights-elastic-ai-assistant-observability">Context-aware insights using the Elastic AI Assistant for Observability</a></p>
</li>
<li>
<p><a href="https://www.elastic.co/blog/elastic-ai-assistant-observability-amazon-bedrock">Getting started with the Elastic AI Assistant for Observability and Amazon Bedrock</a></p>
</li>
</ul>
<h2>Try it out</h2>
<p>Existing Elastic Cloud customers can access many of these features directly from the <a href="https://cloud.elastic.co/">Elastic Cloud console</a>. Not taking advantage of Elastic on cloud? <a href="https://www.elastic.co/cloud/cloud-trial-overview">Start a free trial</a>.</p>
<p>All of this is also possible in your environments. <a href="https://www.elastic.co/observability/universal-profiling">Learn how to get started today</a>.</p>
<p><em>The release and timing of any features or functionality described in this post remain at Elastic's sole discretion. Any features or functionality not currently available may not be delivered on time or at all.</em></p>
<p><em>In this blog post, we may have used or referred to third party generative AI tools, which are owned and operated by their respective owners. Elastic does not have any control over the third party tools and we have no responsibility or liability for their content, operation or use, nor for any loss or damage that may arise from your use of such tools. Please exercise caution when using AI tools with personal, sensitive or confidential information. Any data you submit may be used for AI training or other purposes. There is no guarantee that information you provide will be kept secure or confidential. You should familiarize yourself with the privacy practices and terms of use of any generative AI tools prior to use.</em></p>
<p><em>Elastic, Elasticsearch, ESRE, Elasticsearch Relevance Engine and associated marks are trademarks, logos or registered trademarks of Elasticsearch N.V. in the United States and other countries. All other company and product names are trademarks, logos or registered trademarks of their respective owners.</em></p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/elastic-rag-ai-assistant-application-issues-llm-github/AI_fingertip_touching_human_fingertip.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[Streams Processing: Stop Fighting with Grok. Parse Your Logs in Streams.]]></title>
            <link>https://www.elastic.co/observability-labs/blog/elastic-streams-processing</link>
            <guid isPermaLink="false">elastic-streams-processing</guid>
            <pubDate>Thu, 11 Dec 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[Learn how Streams Processing works under the hood and how to use it to build, test, and deploy parsing logic on live data quickly.]]></description>
            <content:encoded><![CDATA[<p>With Streams, Elastic's new AI capability in 9.2, we make parsing your logs so simple, it's no longer a concern. In general your logs are messy, lots of fields, some understood, some unknown. You have to constantly keep up with the semantics and pattern match to properly parse them. In some cases, even fields you know have different values or semantics. For instance, <code>timestamp</code> is the ingest time, not the event time. Or you can't even filter by <code>log.level</code> or <code>user.id</code> because they're buried inside the <code>message</code> field. As a result, your dashboards are flat and not useful.</p>
<p>Fixing this used to mean leaving Kibana, learning Grok syntax, manually editing ingest pipeline JSON or a complicated Logstash config, and hoping you didn't break parsing for everything else.</p>
<p>We built Streams to fix this, and much more. It's your one place for data processing, built right into Kibana, that lets you build, test, and deploy parsing logic on live data in seconds. It turns a high-risk backend task into a fast, predictable, interactive UI workflow. You can use AI to generate automated GROK rules from a sample of logs, or build them easily with the UI. Let's walk through an example</p>
<h2>A Quick Walkthrough</h2>
<p>Let's fix a common &quot;unstructured&quot; log right now.</p>
<ol>
<li><strong>Start in Discover</strong>. You find a log that isn't structured. The <code>@timestamp</code> is wrong, and fields like <code>log.level</code> aren't being extracted, so your histograms are just a single-color bar.</li>
</ol>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-streams-processing/start-in-discover.png" alt="start in discover" /></p>
<ol start="2">
<li><strong>Inspect the log</strong>. Open the document flyout (the &quot;Inspect a single log event&quot; view). You'll see a button: <strong>&quot;Parse content in Streams&quot;</strong> (or &quot;Edit processing in Streams&quot;). Click it.</li>
</ol>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-streams-processing/inspect-the-log.png" alt="inspect the log" /></p>
<ol start="3">
<li><strong>Go to Processing</strong>. This takes you directly to the Streams processing tab, pre-loaded with sample documents from that data stream. Click <strong>&quot;Create your first step.&quot;</strong></li>
</ol>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-streams-processing/go-to-processing.png" alt="go to streams processing" /></p>
<ol start="4">
<li><strong>Generate a Pattern</strong>. The processor defaults to Grok. You don't have to write any. Just click the <strong>&quot;Generate Pattern&quot;</strong> button. Streams analyzes 100 sample documents from your stream and suggests a Grok pattern for you. By default, this uses the Elastic Managed LLM, but you can configure your own.</li>
</ol>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-streams-processing/generate-pattern.png" alt="generate the pattern" /></p>
<ol start="5">
<li><strong>Accept and Simulate</strong>. Click &quot;Accept.&quot; Instantly, the UI runs a simulation across all 100 sample documents. You can make changes to the pattern or adjust field names, and the simulation re-runs with every keystroke.</li>
</ol>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-streams-processing/accept-and-simulate.png" alt="simulate and accept" /></p>
<p>When you're happy, you save it. Your new logs will now be parsed correctly.</p>
<h2>Powerful Features for Messy, Real-World Logs</h2>
<p>That's the simple case. But real-world data is rarely that clean. Here are the features built to handle the complexity.</p>
<h3>The Interactive Grok UI</h3>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-streams-processing/the-interactive-grok-ui.png" alt="interactive grok" /></p>
<p>When you use the Grok processor, the UI gives you a <strong>visual indication</strong> of what your pattern is extracting. You can see which parts of the <code>message</code> field are being mapped to which new field names. This immediate feedback means you're not just guessing. Autocompletion of GROK patterns and instant pattern validation are also part of it.</p>
<h3>The Diff Viewer</h3>
<p>How do you know what exactly changed? Expand any row in the simulation table. You'll get a diff view showing precisely which fields were added, removed, or modified for that specific document. No more guesswork.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-streams-processing/the-diff-viewer.png" alt="the diff viewer" /></p>
<h3>End to End Simulation and Detecting Failures</h3>
<p>This is the most critical part. Streams doesn't just simulate the processor; it simulates the entire indexing process.
If you try to map a non-timestamp string (like the <code>message</code> field) directly to the <code>@timestamp</code> field, the simulation will show a failure. It detects the mapping conflict before you save it and before it can create a data-mapping conflict in your cluster. This safety net is what lets you move fast.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-streams-processing/end-to-end-simulation.png" alt="end to end simulation" /></p>
<h3>Conditional Processing</h3>
<p>What if one data stream contains a large variety of logs? You can't use one Grok pattern for all.</p>
<p>Streams has conditional processing built for this. The UI lets you build &quot;if-then&quot; logic. The UI shows you exactly what percentage of your sample documents are skipped or processed by your conditions. Right now, the UI supports up to 3 levels of nesting, and we plan to add a YAML mode in the future for more complex logic.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-streams-processing/conditional-processing.png" alt="conditional processing" /></p>
<h3>Changing Your Test Data (Document Samples)</h3>
<p>A random 100-document sample isn't always helpful, especially in a massive, mixed stream from Kubernetes or a central message broker.</p>
<p>You can change the document sample to test your changes on a more specific set of logs. You can either provide documents manually (copy-paste) or, more powerfully, specify a KQL query to fetch 100 specific documents. For example: <code>service.name : &quot;data_processing&quot;</code>, to fetch 100 additional sample documents to be used in the simulation. Now you can build and test a processor on the exact logs you care about.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-streams-processing/changing-your-test-data.png" alt="changing your test data" /></p>
<h2>How Processing Works Under the Hood</h2>
<p>There’s no magic. In simple terms, it's a UI that makes our existing best practices more accessible. As of version 9.2, Streams runs exclusively on <strong>Elasticsearch ingest pipelines</strong>. (We have plans to offer more than that, stay tuned)</p>
<p>When you save your changes, Streams appends processing steps by:</p>
<ol>
<li>Locating the most specific <code>@custom</code> ingest pipeline for your data stream.</li>
<li>Adding a single <code>pipeline</code> processor to it.</li>
<li>This processor calls a new, dedicated pipeline named <code>&lt;stream-name&gt;@stream.processing</code>, which contains the Grok, conditional, and other logic you built in the UI.</li>
</ol>
<p>You can even see this for yourself by going to the <strong>Advanced tab</strong> in your Stream and clicking the pipeline name.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-streams-processing/how-processing-works.png" alt="how processing works" /></p>
<h2>Processing in OTel, Elastic Agent, Logstash, or Streams? What to Use?</h2>
<p>This is a fair question. You have lots of ways to parse data.</p>
<ul>
<li><strong>Best: Structured logging at the Source</strong>. If you control the app writing the logs, make it log JSON in the right format of your choice. This will always stay the best way to do logging, but it's not always possible.</li>
<li><strong>Good, but not all the time: Elastic Agent + Integrations:</strong> If there is an existing integration for collecting and parsing your data, Streams won't do it any better. Use it!</li>
<li><strong>Good for tech savvy users: OTel at the Edge</strong>. Use OTel (with OTTL) to set yourself up for the future.</li>
<li><strong>The easy Catch-All: In Streams</strong>. Especially when using an Integration that primarily just ships the data into Elastic, Streams can add a lot of value. The Kubernetes Logs integration is a good example of this where an Integration is used, but most logs aren't parsed automatically as they may be from a wide variety of pods.</li>
</ul>
<p>Think of Streams as your universal &quot;catch-all&quot; for everything that arrives unstructured. It's perfect for data from sources you don't control, for legacy systems, or for when you just need to fix a parsing error right now without a full application redeploy.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elastic-streams-processing/processing-in-otel.png" alt="processing in otel" /></p>
<p>A quick note on schemas: Streams can handle both ECS (Elastic Common Schema) and OTel (OpenTelemetry) data. By default, it assumes your target schema is ECS. However, Streams will automatically detect and adapt to the OTel schema if your Stream's name contains the word “otel”, or if you're using the special Logs Stream (currently in tech preview). You get the same visual parsing workflow regardless of the schema.</p>
<p>All processing changes can also be made using a Kibana API. Note that the API is still in tech preview while we mature some of the functionality.</p>
<h2>Summary</h2>
<p>Parsing logs shouldn't be a tedious, high-stakes, backend-only task. Streams moves the entire workflow from a complex, error-prone approach to an interactive UI right where you already are. You can now build, test, and deploy parsing logic with instant, safe feedback. This means you can stop fighting your logs and finally start using them. The next time you see a messy log, don't ignore it. Click &quot;Parse in Streams&quot; and fix it in 60 seconds.</p>
<p>Check out more log analytics articles in <a href="https://www.elastic.co/observability-labs/blog/tag/log-analytics">Elasitc Observability Labs</a>.</p>
<p>Try out Elastic. Sign up for a trial at <a href="https://cloud.elastic.co/registration?fromURI=%2Fhome">Elastic Cloud</a>.</p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/elastic-streams-processing/cover.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[LLM Observability for Google Cloud’s Vertex AI platform - understand performance, cost and reliability]]></title>
            <link>https://www.elastic.co/observability-labs/blog/elevate-llm-observability-with-gcp-vertex-ai-integration</link>
            <guid isPermaLink="false">elevate-llm-observability-with-gcp-vertex-ai-integration</guid>
            <pubDate>Wed, 09 Apr 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[Enhance LLM observability with Elastic's GCP Vertex AI Integration — gain actionable insights into model performance, resource efficiency, and operational reliability.]]></description>
            <content:encoded><![CDATA[<p>As organizations increasingly adopt large language models (LLMs) for AI-powered applications such as content creation, Retrieval-Augmented Generation (RAG), and data analysis, SREs and developers face new challenges. Tasks like monitoring workflows, analyzing input and output, managing query latency, and controlling costs become critical. LLM observability helps address these issues by providing clear insights into how these models perform, allowing teams to quickly identify bottlenecks, optimize configurations, and improve reliability. With better observability, SREs can confidently scale LLM applications, especially on platforms like <a href="https://cloud.google.com/vertex-ai">Google Cloud’s Vertex AI</a>.</p>
<h3>New Elastic Observability LLM integration with Google Cloud’s Vertex AI platform</h3>
<p>We are thrilled to announce general availability of monitoring LLMs hosted in Google Cloud through the <a href="https://www.elastic.co/docs/current/integrations/gcp_vertexai">Elastic integration with Vertex AI</a>. This integration enables users to experience enhanced LLM Observability by providing deep insights into the usage, cost and operational performance of models on Vertex AI, including latency, errors, token usage, frequency of model invocations as well as resources utilized by models. By leveraging this data, organizations can optimize resource usage, identify and resolve performance bottlenecks, and enhance the model efficiency and accuracy.</p>
<h3>Observability needs for AI-powered applications using the Vertex AI platform</h3>
<p>Leveraging AI models creates unique needs around the observability and monitoring of AI-powered applications. Some of the challenges that come with using LLMs are related to the high cost to call the LLMs, the quality and safety of LLM responses, and the performance, reliability and availability of the LLMs.</p>
<p>Lack of visibility into LLM observability data can make it harder for SREs and DevOps teams to ensure their AI-powered applications meet their service level objectives for reliability, performance, cost and quality of the AI-generated content and have enough telemetry data to troubleshoot related issues. Thus, robust LLM observability and detection of anomalies in the performance of models hosted on Google Cloud’s Vertex AI platform in real time is critical for the success of AI-powered applications.</p>
<p>Depending on the needs of their LLM applications, customers can make use of a growing list of models hosted on the Vertex AI platform such as Gemini 2.0 Pro, Gemini 2.0 Flash, and Imagen for image generation. Each model excels in specific areas and generates content in some modalities including Language, Audio, Vision, Code, etc. No two models are the same; each model has specific performance characteristics. So, it is important that service operators are able to track the individual performance, behaviour and cost of each model.</p>
<h3>Unlocking Insights with Vertex AI Metrics</h3>
<p>The Elastic integration with Google Cloud’s Vertex AI platform collects a wide range of metrics from models hosted on Vertex AI, enabling users to monitor, analyze, and optimize their AI deployments effectively.</p>
<p>Once you use the integration, you can review all the metrics in the Vertex AI dashboard</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elevate-llm-observability-with-gcp-vertex-ai-integration/Overview.png" alt="Overview Dashboard" /></p>
<p>These metrics can be categorized into the following groups:</p>
<h4>1. Prediction Metrics</h4>
<p>Prediction metrics provide critical insights into model usage, performance bottlenecks, and reliability. These metrics help ensure smooth operations, optimize response times, and maintain robust, accurate predictions.</p>
<ul>
<li>
<p><strong>Prediction Count by Endpoint</strong>: Measures the total number of predictions across different endpoints.</p>
</li>
<li>
<p><strong>Prediction Latency</strong>: Provides insights into the time taken to generate predictions, allowing users to identify bottlenecks in performance.</p>
</li>
<li>
<p><strong>Prediction Errors</strong>: Monitors the count of failed predictions across endpoints.</p>
</li>
</ul>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elevate-llm-observability-with-gcp-vertex-ai-integration/Prediction.png" alt="Prediction Metrics" /></p>
<h4>2. Model Performance Metrics</h4>
<p>Model performance metrics provide crucial insights into deployment efficiency, and responsiveness. These metrics help optimize model performance and ensure reliable operations.</p>
<ul>
<li>
<p><strong>Model Usage</strong>: Tracks the usage distribution among different model deployments.</p>
</li>
<li>
<p><strong>Token Usage</strong>: Tracks the number of tokens consumed by each model deployment, which is critical for understanding model efficiency.</p>
</li>
</ul>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elevate-llm-observability-with-gcp-vertex-ai-integration/token_model_usage.png" alt="Token model usage" /></p>
<ul>
<li>
<p><strong>Invocation Rates</strong>: Tracks the frequency of invocations made by each model deployment.</p>
</li>
<li>
<p><strong>Model Invocation Latency</strong>: Measures the time taken to invoke a model, helping in diagnosing performance issues.</p>
</li>
</ul>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elevate-llm-observability-with-gcp-vertex-ai-integration/Invocation_Vertex.png" alt="Model Invocation Metrics" /></p>
<h4>3. Resource Utilization Metrics</h4>
<p>Resource utilization metrics are vital for monitoring resource efficiency and workload performance. They help optimize infrastructure, prevent bottlenecks, and ensure smooth operation of AI deployments.</p>
<ul>
<li>
<p><strong>CPU Utilization</strong>: Monitors CPU usage to ensure optimal resource allocation for AI workloads.</p>
</li>
<li>
<p><strong>Memory Usage</strong>: Tracks the memory consumed across all model deployments.</p>
</li>
<li>
<p><strong>Network Usage</strong>: Measures bytes sent and received, providing insights into data transfer during model interactions.</p>
</li>
</ul>
<p><img src="https://www.elastic.co/observability-labs/assets/images/elevate-llm-observability-with-gcp-vertex-ai-integration/Resource_Utilization.png" alt="Resource Utilization Metrics" /></p>
<h4>4. Overview Metrics</h4>
<p>These metrics give an overview of the models deployed in Google Cloud’s Vertex AI platform. They are essential for tracking overall performance, optimizing efficiency, and identifying potential issues across deployments.</p>
<ul>
<li>
<p><strong>Total Invocations</strong>: The overall count of prediction invocations across all models and endpoints, providing a comprehensive view of activity.</p>
</li>
<li>
<p><strong>Total Tokens</strong>: The total number of tokens processed across all model interactions, offering insights into resource utilization and efficiency.</p>
</li>
<li>
<p><strong>Total Errors</strong>: The total count of errors encountered across all models and endpoints, helping identify reliability issues.</p>
</li>
</ul>
<p>All metrics can be filtered by <strong>region</strong>, offering localized insights for better analysis.</p>
<p>Note: The Elastic I integration with Vertex AI provides comprehensive visibility into both deployment models: provisioned throughput, where capacity is pre-allocated, and pay-as-you-go, where resources are consumed on demand.</p>
<h3>Conclusion</h3>
<p>This <a href="https://www.elastic.co/docs/current/integrations/gcp_vertexai">integration with Vertex AI</a> represents a significant step forward in enhancing the LLM Observability for users of Google Cloud’s Vertex AI platform. By unlocking a wealth of actionable data, organizations can assess the health, performance and cost of LLMs and troubleshoot operational issues, ensuring scalability, and accuracy in AI-driven applications.</p>
<p>Now that you know how the Vertex AI integration enhances LLM Observability, it’s your turn to try it out n. Spin up an Elastic Cloud, and start monitoring your LLM applications hosted on Google Cloud’s Vertex AI platform.</p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/elevate-llm-observability-with-gcp-vertex-ai-integration/vertexai-title.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[2025 observability trends: Maturing beyond the hype]]></title>
            <link>https://www.elastic.co/observability-labs/blog/emerging-trends-in-observability-2025</link>
            <guid isPermaLink="false">emerging-trends-in-observability-2025</guid>
            <pubDate>Thu, 27 Feb 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[Discover what 500+ decision-makers revealed about OpenTelemetry adoption, GenAI integration, and LLM monitoring—insights that separate innovators from followers in Elastic's 2025 observability survey.]]></description>
            <content:encoded><![CDATA[<h1>2025 observability trends: Maturing beyond the hype</h1>
<p>Our latest survey of over 500 observability decision-makers reveals how dramatically the landscape has evolved as we move through 2025. What strikes me most is how observability has moved beyond its technical roots to become a true business imperative. Let’s dive into what we're seeing in the industry.</p>
<h2>The investment paradox of observability in 2025</h2>
<p><img src="https://www.elastic.co/observability-labs/assets/images/emerging-trends-in-observability-2025/image5.png" alt="" /></p>
<p>Here's something fascinating: 96% of executives in our survey expect observability to remain a key investment area. Yet almost all of them (97%) are hitting roadblocks in realizing full value. And surprisingly, the primary hurdles for observability are not technical or complicated in nature, can you guess what they might be?</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/emerging-trends-in-observability-2025/image10.png" alt="" /></p>
<p>For 2025, IT leaders are challenged with financial hurdles for their observability. I'm seeing this tension play out constantly in conversations with leaders - they know they need to invest, but they're grappling with budget constraints, licensing costs, and proving ROI for their organizations. This creates an interesting dynamic where organizations must carefully balance increasing investment with rigorous cost optimization and business metrics.</p>
<p>What's particularly interesting is how this paradox is forcing organizations to become more strategic about their investments. Leaders are no longer just throwing money at the problem - they're thinking carefully about how to maximize value from every dollar spent.</p>
<h2>Why observability maturity Is making all the difference</h2>
<p>The data really jumps out at me here. The gap between observability experts and newcomers tells a compelling story that I wasn't expecting to see. Expert organizations are significantly outperforming their peers across every key metric:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/emerging-trends-in-observability-2025/image9.png" alt="" /></p>
<ul>
<li>91% of expert organizations are deploying applications and infrastructure faster (compared to just 34% of those in early stages)</li>
</ul>
<p><img src="https://www.elastic.co/observability-labs/assets/images/emerging-trends-in-observability-2025/image11.png" alt="" /></p>
<ul>
<li>82% are successfully reducing operational costs (versus 56% of early-stage organizations)</li>
</ul>
<p><img src="https://www.elastic.co/observability-labs/assets/images/emerging-trends-in-observability-2025/image4.png" alt="" /></p>
<ul>
<li>71% achieve better MTTR for incidents (while only 40% of early-stage organizations do)</li>
</ul>
<p>What I find particularly fascinating is how some benefits go beyond just maturity levels. About 80% of organizations report better customer issue response times regardless of their maturity stage. It tells me that even basic observability delivers immediate customer-facing value. This is crucial information for organizations just starting their observability journey - they can expect to see tangible benefits right from the start. But the overarching story may be that observability maturity leads teams from reactive to proactive and allows them to focus on higher level, value-add activities.</p>
<h2>Cost management: the new imperative</h2>
<p>The numbers around cost management paint a clear picture of where the industry is heading - 97% of IT decision-makers are actively managing observability costs, and 86% feel personally responsible for business outcomes.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/emerging-trends-in-observability-2025/image2.png" alt="" /></p>
<p>I'm seeing a clear trend where leaders are taking concrete steps in their day to day work:</p>
<ul>
<li>Consolidating their observability toolset while maintaining capabilities, they don’t want to lose anything</li>
<li>Implementing usage-based pricing models</li>
<li>Establishing clear ROI metrics</li>
<li>Creating cross-functional teams to optimize spending</li>
</ul>
<p>This isn't just about cutting costs - it's about being smarter with resources. Organizations are learning that more tools don't necessarily mean better observability.</p>
<h2>Two technologies reshaping the observability landscape</h2>
<h3>AI's growing impact</h3>
<p>The enthusiasm for AI is remarkable - 94% of respondents see its tremendous potential. What fascinates me is how concerns about Generative AI reliability have actually decreased from 64% to 55% over the past year.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/emerging-trends-in-observability-2025/image7.png" alt="" /></p>
<p>Leaders are particularly excited about:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/emerging-trends-in-observability-2025/image1.png" alt="" /></p>
<ul>
<li>Automated correlation of logs, metrics, and traces (72% of respondents)</li>
<li>Predictive analytics for preventing outages</li>
<li>Natural language interfaces for querying observability data</li>
<li>Automated root cause analysis</li>
</ul>
<p>The key shift I'm seeing for the upcoming year is the move from AI as a buzzword to AI as a practical tool delivering real value in observability workflows.</p>
<p>Generative AI capabilities paired with retrieval augmented generation (RAG) capabilities allow organizations to leverage the power of LLMs and private data (e.g., runbooks, alerts, business data) to deliver relevant and meaningful results and identify and solve problems faster while reducing noise.</p>
<h3>OpenTelemetry's continued momentum</h3>
<p><img src="https://www.elastic.co/observability-labs/assets/images/emerging-trends-in-observability-2025/image3.png" alt="" /></p>
<p>Looking at expert organizations, 80% are either experimenting with or have deployed OpenTelemetry. This isn't just about technology adoption - it's about building for the future with open standards. The correlation between OpenTelemetry adoption and overall observability maturity is correlated and unmistakable.</p>
<p>What's particularly interesting is how OpenTelemetry is changing the vendor landscape. Organizations are increasingly demanding OpenTelemetry support from their vendors, seeing it as a way to future-proof their observability investments and avoid vendor lock-in. Thinking back to how Linux shifted the server landscape, can we expect to see the same in the observability domain?</p>
<h2>Business integration and insights deepens</h2>
<hr />
<p><img src="https://www.elastic.co/observability-labs/assets/images/emerging-trends-in-observability-2025/image8.png" alt="" /></p>
<p>Here's what I find most compelling: 64% of expert organizations are frequently correlating operational data with business outcomes, while only 9% of early-stage organizations do the same. This represents a fundamental shift from technical monitoring to business observability.</p>
<p>This isn't just about uptime anymore - organizations are increasingly using observability data to:</p>
<ul>
<li>Make informed business decisions</li>
<li>Improve customer experience</li>
<li>Optimize resource allocation</li>
<li>Drive innovation</li>
</ul>
<h2>Looking ahead</h2>
<p>As we continue through 2025, I'm seeing observability mature beyond its initial promise. Organizations are focusing less on basic implementation and more on delivering real business value through:</p>
<ul>
<li>Deeper business integration, like mapping system performance directly to revenue metrics</li>
<li>Optimized cost management through new data lake technology, efficient storage and intelligent retention</li>
<li>AI-enhanced capabilities powered by LLMs and Agentic AI</li>
<li>Standardized instrumentation through OpenTelemetry, reducing vendor lock-in</li>
</ul>
<p>The path to success in 2025 isn't just about having the right tools - it's about building mature practices that deliver measurable business value while managing costs effectively. The organizations that can balance these competing demands while maintaining focus on business outcomes are the ones pulling ahead.</p>
<p>What are you seeing in your organization's observability journey? Are these trends aligning with your experience?</p>
<p>If you would like to dig in deeper on emerging observability trends, download <a href="https://www.elastic.co/resources/observability/report/landscape-observability-report">our full report</a> or watch the on-demand webinar, <a href="https://www.elastic.co/virtual-events/observability-trends-2025">2025 Observability trends: Maturing beyond the hype and delivering results</a>!</p>
<p>The release and timing of any features or functionality described in this post remain at Elastic's sole discretion. Any features or functionality not currently available may not be delivered on time or at all.</p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/emerging-trends-in-observability-2025/trends.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[Reconciliation in Elastic Streams: A Robust Architecture Deep Dive]]></title>
            <link>https://www.elastic.co/observability-labs/blog/from-tangled-to-streamlined-how-we-made-streams-robust-by-using-reconciliation</link>
            <guid isPermaLink="false">from-tangled-to-streamlined-how-we-made-streams-robust-by-using-reconciliation</guid>
            <pubDate>Tue, 04 Nov 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[Learn how Elastic's engineering team refactored Streams using a reconciliation model inspired by Kubernetes & React to build a robust, extensible, and debuggable system.]]></description>
            <content:encoded><![CDATA[<p>Streams is a new, unified approach to data management in the Elastic Stack. It wraps a set of existing Elasticsearch building blocks—data streams, index templates, ingest pipelines, retention policies—into a single, coherent primitive: the Stream. Instead of configuring these parts individually and in the right order, users can now rely on Streams to orchestrate them safely and automatically. With a unified UI in Kibana and a simplified API, Streams reduces cognitive load, lowers the risk of misconfiguration, and supports more flexible workflows like late binding—where users can ingest data first and decide how to process and route it later.</p>
<p>But behind that clean user experience lies a fast-moving, evolving codebase. In this post, we’ll explore how we rethought its architecture to keep up with product demands—while laying the groundwork for future flexibility and scale.</p>
<p>Rapid experimentation often leads to messy code—but before shipping to customers, we have to ask: If this succeeds, can we continue evolving it?
That question puts code health front and center. To move fast in the long term, we need a foundation that supports iteration.</p>
<p>When I joined the Streams team about six months ago, the project was moving fast through uncharted territory amid high uncertainty. This combination of speed and uncertainty created the perfect conditions for, well, spaghetti code—crafted by some of our most senior engineers, doing their best with a recipe missing a few ingredients.</p>
<p>The code was pragmatic and effective: it did exactly what it needed to do. But it was becoming increasingly difficult to understand and extend. Related logic was scattered across many files, with little separation of concerns, making it difficult to safely identify where and how to introduce changes. And the project still had a long road ahead.</p>
<p>Recently, we undertook a refactor of the underlying architecture—not just to bring greater clarity and structure to the codebase, but to establish clear phases that make it easier to debug and evolve. Our primary goal was to build a foundation that would let us continue moving quickly and confidently.
As a secondary goal, we aimed to enable new capabilities like bulk updates, dry runs, and system diagnostics.</p>
<p>In this post, we’ll briefly explore the challenges that prompted a new approach, share the architectural patterns that inspired us, explain how the new design works under the hood, and highlight what it enables for the future.</p>
<h2>The Challenges We Faced</h2>
<p>Streams aims to be a declarative model for data management. Users describe how data should flow: where it should go, what processing should happen along the way, and which mappings should apply. Behind the scenes, each API request results in one or more Elasticsearch resources being changed.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/from-tangled-to-streamlined-how-we-made-streams-robust-by-using-reconciliation/mess.png" alt="An image evoking a tangled mess" /></p>
<p>Before the refactor, the underlying code was increasingly difficult to reason about. There was no clear lifecycle that each request followed. Data was loaded only when it happened to be needed, validation was scattered across different functions, and cascading changes—like child streams reacting to parent updates—were applied recursively and implicitly. Elasticsearch requests could happen at any point during a request.</p>
<p>This led to several key challenges:</p>
<ul>
<li>
<p><strong>No clear place for validation</strong><br />
Without a single, centralized validation step, engineers weren’t sure where to add new checks—or whether existing ones would even run reliably. Some validations happened early, others late.</p>
</li>
<li>
<p><strong>No clear picture of the overall system state</strong><br />
Because there was no way to manage the system state as a whole it was hard to reason about or validate the state. We couldn’t easily check whether a change was valid in the context of all other existing streams or dependencies.</p>
</li>
<li>
<p><strong>Unpredictable side effects</strong><br />
Since Elasticsearch operations could occur at different points in the flow, failures were harder to handle or roll back. We didn’t have a clear “commit point” where the changes were executed.</p>
</li>
<li>
<p><strong>Tangled stream logic</strong><br />
Logic for different types of streams was mixed together in shared code paths, often guarded by conditionals. This made it hard to isolate behavior, test individual types, or add new ones without risking unintended consequences.</p>
</li>
</ul>
<p>These challenges made it clear: we needed a more structured foundation, one capable of supporting both the current complexity and future growth.</p>
<h2>What We Needed to Move Forward</h2>
<p>To move faster yet with confidence, we needed a foundation that could evolve gracefully, make behavior easier to reason about, and reduce the likelihood of unexpected side effects.</p>
<p>We aligned around a few key goals:</p>
<ul>
<li>
<p><strong>A clear request lifecycle</strong><br />
Each request should move through clear, well-defined phases: loading the current state, applying changes, validating the resulting state, determining the Elasticsearch actions, and executing the actions. This structure would help engineers understand where things happen—and why.</p>
</li>
<li>
<p><strong>A unified state model</strong><br />
We wanted a clear model of desired vs. current state—a single place to reason about the outcome of a change. This would enable safer validation, more efficient updates, and easier debugging by allowing us to compute the difference between the two states.</p>
</li>
<li>
<p><strong>A single commit point</strong><br />
All Elasticsearch changes should happen in one place, after everything’s validated and we know exactly what needs to change. This would reduce side effects, make failures easier to manage, and unlock support for dry runs.</p>
</li>
<li>
<p><strong>Isolated stream logic</strong><br />
We needed clearer separation between stream types so each could be developed and tested in isolation. This would simplify adding new types, reduce unintended side effects, and clarify whether changes belong to a stream type or the state management layer.</p>
</li>
<li>
<p><strong>Bulk operations and system introspection</strong><br />
Finally, we wanted to support features like bulk updates, dry runs, and health diagnostics—capabilities that were difficult or impossible with the old design. A more explicit and inspectable model of system state would make this possible.</p>
</li>
</ul>
<p>These goals became our north star as we explored new architectural patterns to get there, with a strong focus on comparing the current state with the desired state.</p>
<h2>Where We Drew Inspiration From</h2>
<p>Our new design drew inspiration from two well-known open source projects: <a href="https://kubernetes.io/">Kubernetes</a> and <a href="https://react.dev/">React</a>. Though very different, both share a central concept: reconciliation.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/from-tangled-to-streamlined-how-we-made-streams-robust-by-using-reconciliation/reconciliation.png" alt="An image showing a flow chart for reconciliation" /></p>
<p>Reconciliation means comparing two states, calculating their differences, and taking the necessary actions to move the system from its current state to its desired state.</p>
<ul>
<li>
<p>In <a href="https://kubernetes.io/docs/concepts/architecture/controller/">Kubernetes</a>, you declare the desired state of your resources, and the controller continuously works to align the cluster with that state.</p>
</li>
<li>
<p>In <a href="https://legacy.reactjs.org/docs/faq-internals.html">React</a>, each component defines how it should render, and the virtual DOM updates the real DOM efficiently to match that.</p>
</li>
</ul>
<p>We were also inspired by the <a href="https://mmapped.blog/posts/29-plan-execute">Plan/Execute</a> pattern which aims to separate decision making from execution. This sounded like what we needed in order to perform all validations before committing to any actions—ensuring we could reason about and inspect the system's intent ahead of time.</p>
<p>These concepts resonated with what we needed. It made clear that we required two key pieces:</p>
<ol>
<li>
<p>A model representing system state, responsible for comparing states and driving the overall workflow (like the Kubernetes controller loop).</p>
</li>
<li>
<p>A representation of individual streams that make up that state, handling the specific logic for each stream type (like React components).</p>
</li>
</ol>
<p>Each Stream is defined and stored in Elasticsearch. We recognized a disconnect between data management and state changes in our existing code, so we designed each stream to manage both. This fits naturally with the <a href="https://www.martinfowler.com/eaaCatalog/activeRecord.html">Active Record pattern</a>, where a class encapsulates both domain logic and persistence.</p>
<p>To make the system easier to extend and the state model’s interface simpler, we implemented an abstract Active Record class using the <a href="https://refactoring.guru/design-patterns/template-method">Template Method pattern</a>, clearly defining the interface new stream types must follow.</p>
<p>We did have some concerns that adopting these more advanced patterns—like reconciliation, the Active Record, and Template Method—might make it harder for new or less experienced engineers to get up to speed. While the code would be cleaner and more straightforward for those familiar with the patterns, we worried it could create a barrier for juniors or newcomers unfamiliar with these concepts.</p>
<p>In practice, however, we found the opposite: the code became easier to follow because the patterns provided a clear, consistent structure. More importantly, the architectural choices helped keep the focus on the domain itself, rather than on complex implementation details, making it more approachable for the whole team. The patterns are there but the code doesn't talk about them, it talks about the domain.</p>
<h2>How We Structured the System</h2>
<p>When a request hits one of our API endpoints in Kibana, the handler performs basic request validation, then passes the request to the Streams Client. The client’s job is to translate the request into one or more Change objects. Each Change represents the creation, modification, or deletion of a Stream.</p>
<p>These Change objects are then passed to a central class we introduced called <code>State</code>, which plays two key roles:</p>
<ul>
<li>
<p>It holds the set of Stream instances that make up the current version of the system.</p>
</li>
<li>
<p>It orchestrates the pipeline that applies changes and transitions from one state to another.</p>
</li>
</ul>
<p>Let’s walk through the key phases the State class manages when applying a change.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/from-tangled-to-streamlined-how-we-made-streams-robust-by-using-reconciliation/flow.png" alt="Flowchart of the phases" /></p>
<h3>Loading the Starting State</h3>
<p>First, the State class loads the current system state by reading the stored Stream definitions from Elasticsearch. This becomes our reference point for all subsequent comparisons—used during validation, diffing, and action planning.</p>
<h3>Applying Changes</h3>
<p>We begin by cloning the starting state. Each Stream is responsible for cloning itself.
Then we process each incoming Change:</p>
<ul>
<li>
<p>The change is presented to all Streams in the current state (creating a new one if needed).</p>
</li>
<li>
<p>Each Stream can react by updating itself and optionally emitting cascading changes—additional changes that ripple through related Streams.</p>
</li>
<li>
<p>Cascading changes are processed in a loop until no more are generated (or until we hit a safety threshold).</p>
</li>
</ul>
<p>We then move to the next requested Change.<br />
If any requested or cascading Change cannot be applied safely, the system aborts the entire request to prevent partial updates.</p>
<h3>Validating the Desired State</h3>
<p>Once we’ve applied all Changes and cascading effects, we run validations to ensure the resulting configuration is safe and consistent.</p>
<p>Each Stream is asked to validate itself in the context of the full desired state and the original starting state. This allows for both localized checks (within a Stream) and broader coordination (between related Streams). If any validation fails, we abort the request.</p>
<h3>Determining Actions</h3>
<p>Next, each Stream is asked to determine what Elasticsearch actions are needed to move from the starting state to the desired state. This is the first point where the system needs to consider which Elasticsearch resources back an individual Stream.</p>
<p>If the request is a dry run, we stop here and return a summary of what would happen. If it’s meant to be executed, we move to the next phase.</p>
<h3>Planning and Execution</h3>
<p>The list of Elasticsearch actions is handed off to a dedicated class called <code>ExecutionPlan</code>. This class handles:</p>
<ul>
<li>
<p>Resolving cross-stream dependencies that individual Streams cannot address alone.</p>
</li>
<li>
<p>Organizing the actions into the correct order to ensure safe application (e.g. to avoid data loss when routing rules change).</p>
</li>
<li>
<p>Maximizing parallelism wherever possible within those ordering constraints.</p>
</li>
</ul>
<p>If the plan executes successfully, we return a success response from the API.</p>
<h3>Handling Failures</h3>
<p>If the plan fails during execution, the <code>State</code> class attempts a roll back—it computes a new plan that should return the system to its starting state (by going from desired state to starting state instead) and tries to execute it.</p>
<p>If the roll back also fails, we have a fallback mechanism: a “reset” operation that re-applies the known-good state stored in Elasticsearch, skipping diffing entirely.</p>
<h3>A Closer Look at the Stream Active Record Classes</h3>
<p>All Streams in the State are subclasses of an abstract class called <code>StreamActiveRecord</code>. This class is responsible for:</p>
<ul>
<li>
<p>Tracking the change status of the Stream</p>
</li>
<li>
<p>Routing change application, validation, and action determination to specialized template method hooks implemented by its concrete subclasses based on the change status.</p>
</li>
</ul>
<p>These hooks are as follows:</p>
<ul>
<li>
<p>Apply upsert / Apply deletion</p>
</li>
<li>
<p>Validate upsert / Validate deletion</p>
</li>
<li>
<p>Determine actions for creation / change / deletion</p>
</li>
</ul>
<p>With this architecture in place, we’ve created a clear, phased, and declarative flow from input to action—one that’s modular, testable, and resilient to failure. It cleanly separates generic stream lifecycle logic (like change tracking and orchestration) from stream-specific behaviors (such as what “upsert” means for a given Stream type), enabling a highly extensible system. This structure allows us to isolate side effects, validate with confidence, and reason more clearly about system-wide behavior—all while supporting dry runs and bulk operations.</p>
<p>Now that we’ve covered how it works, let’s explore what this unlocks—the capabilities, safety guarantees, and new workflows this design makes possible.</p>
<h2>What This Unlocks</h2>
<p>The reconciliation based design we landed on isn’t just easier to reason about—it directly addresses many of the core limitations we faced in the earlier version of the system.</p>
<p><strong>Bulk operations and dry runs, by design</strong></p>
<p>One of our key goals was to support bulk configuration changes across many Streams in a single request. The previous codebase made this difficult because the side effects were interleaved with decision-making logic, making it risky to apply multiple changes at once.</p>
<p>Now, bulk changes are the default. The <code>State</code> class handles any number of changes, tracks cascading effects automatically, and validates the end result as a whole. Whether you're updating one Stream or fifty, the pipeline handles it consistently.</p>
<p>Dry runs were another desired feature. Because actions are now computed in a side-effect-free step—before anything is sent to Elasticsearch—we can generate a full preview of what would happen. This includes both which Streams would change and what specific Elasticsearch operations would be performed. That visibility helps users and developers make confident, informed decisions.</p>
<p><strong>Easier debugging, better diagnostics</strong></p>
<p>In the old system, debugging required reconstructing the execution context and piecing together side effects. Now, every phase of the pipeline is explicit and testable in isolation by following the phases.</p>
<p>Because validation and Elasticsearch actions are now tied directly to the Stream definition and lifecycle, any inconsistencies or errors are easier to trace to their source.</p>
<p><strong>Validated planning before execution</strong></p>
<p>Because we now validate and plan <em>before</em> making any changes, the risk of leaving the system in an inconsistent or partially-updated state has been greatly reduced. All actions are determined in advance, and only executed once we’re confident the entire set of changes is valid and coherent.</p>
<p>And if something does go wrong during execution, we can lean on the fact that both the starting and desired states are fully modeled in memory. This allows us to generate a roll back plan automatically, and when that’s not possible, fall back to a complete reset from the stored state. In short: safety is now built in, not bolted on.</p>
<p><strong>Extensible by default</strong></p>
<p>Adding a new type of Stream used to mean editing logic scattered across multiple files.
Now, it’s a focused, well-defined task. You subclass <code>StreamActiveRecord</code> and implement the handful of lifecycle hooks.</p>
<p>That’s it. The orchestration, tracking, and dependency handling are already wired up. That also means it’s easier to onboard new developers or experiment with new Stream types without fear of breaking unrelated parts of the system.</p>
<p><strong>Easier to test</strong></p>
<p>Because each Stream is now encapsulated and has clear, isolated responsibilities, testing is much simpler. You can test individual Stream classes by simulating specific inputs and asserting the resulting cascading changes, validation results, or Elasticsearch actions. There's no need to spin up a full end-to-end environment just to test a single validation.</p>
<h2>What’s Next</h2>
<p>At Elastic, we live by our Source Code, which states “Progress, SIMPLE Perfection”—a reminder to favor steady, incremental improvement over chasing perfection.</p>
<p>This new system is a solid foundation—but it’s only the beginning. Our focus so far has been on clarity, safety, and extensibility, and while we’ve addressed some long-standing pain points, there’s still plenty of room to evolve.</p>
<h3>Continuous improvement ahead</h3>
<p>We intentionally shipped this work with a sharp scope and have already identified several enhancements that we will be adding in the coming weeks:</p>
<ul>
<li>
<p><strong>Introduce a locking layer</strong><br />
To safely handle concurrent updates, we plan to introduce a locking mechanism that prevents race conditions during parallel modifications.</p>
</li>
<li>
<p><strong>Expose bulk and dry-run features via our APIs</strong><br />
The <code>State</code> class already supports them—now it’s time to make those capabilities available to users.</p>
</li>
<li>
<p><strong>Improve debugging output</strong><br />
Now that state transitions are modeled explicitly, we can expose clearer diagnostics to help both users and developers reason about changes.</p>
</li>
<li>
<p><strong>Avoiding Redundant Elasticsearch Requests</strong><br />
Currently we make multiple redundant requests during validation. Introducing a lightweight in-memory cache would let us avoid reloading the same resource more than once.</p>
</li>
<li>
<p><strong>Improve access controls</strong><br />
Currently, we rely on Elasticsearch to enforce access control. Because a single change can touch many different resources, it’s difficult to determine up front which privileges are required. We plan to extend our action definitions with privilege metadata, enabling us to validate the full set of required permissions before executing any actions. This will let us detect and report missing privileges early—before the plan runs.</p>
</li>
<li>
<p><strong>Add APM instrumentation</strong><br />
With the system structured in distinct, well-defined phases, we’re now in a great position to add performance instrumentation. This will help us identify bottlenecks and improve responsiveness over time.</p>
</li>
</ul>
<h3>Revisiting responsibilities</h3>
<p>As our orchestration becomes more robust, we’re also re-evaluating where it should live. Large-scale bulk operations, for example, might eventually be better handled closer to Elasticsearch itself, where we can benefit from greater atomicity and tighter performance guarantees. That kind of deep integration would have been premature earlier on—when we were still figuring out the right abstractions and phases for the system. But now that the design has stabilized, we’re in a much better position to start that conversation.</p>
<h3>Built to evolve</h3>
<p>We designed this system with adaptability in mind. Whether improvements come in the form of internal refactors, better developer experience, or deeper collaboration with Elasticsearch, we’re in a strong position to keep evolving. The architecture is modular by design—and that gives us both the stability to rely on and the flexibility to grow.</p>
<h2>Wrapping Up</h2>
<p>Building robust, maintainable systems is never just about code — it’s about aligning architecture with the evolving needs and direction of the product. Our journey refactoring Streams reaffirmed that a thoughtful, phased approach not only improves technical clarity but also empowers teams to move faster and innovate more confidently.</p>
<p>If you’re working on complex systems facing similar challenges—whether tangled logic, unpredictable side effects, or the need for extensibility—you’re not alone. We hope our story offers some useful insights and inspiration as you shape your own path forward.</p>
<p>We welcome feedback and collaboration from the community—whether it’s in the form of questions, ideas, or code.</p>
<p>To learn more about Streams, explore:</p>
<p><em>Read about</em> <a href="https://www.elastic.co/observability-labs/blog/reimagine-observability-elastic-streams"><em>Reimagining streams</em></a></p>
<p><em>Look at the</em> <a href="http://elastic.co/elasticsearch/streams"><em>Streams website</em></a></p>
<p><em>Read the</em> <a href="https://www.elastic.co/docs/solutions/observability/streams/streams"><em>Streams documentation</em></a></p>
<p><em>Check out the</em> <a href="https://github.com/elastic/kibana/pull/211696"><em>pull request on GitHub</em></a> to dive into the code or join the conversation.</p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/from-tangled-to-streamlined-how-we-made-streams-robust-by-using-reconciliation/article.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[How to remove PII from your Elastic data in 3 easy steps]]></title>
            <link>https://www.elastic.co/observability-labs/blog/remove-pii-data</link>
            <guid isPermaLink="false">remove-pii-data</guid>
            <pubDate>Tue, 20 Jun 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[Personally Identifiable Information compliance is an ever increasing challenge for any organization. With Elastic's intuitive ML interface and parsing capabilities, sensitive data may be easily redacted from unstructured data with ease.]]></description>
            <content:encoded><![CDATA[<p>Personally identifiable information (PII) compliance is an ever-increasing challenge for any organization. Whether you’re in ecommerce, banking, healthcare, or other fields where data is sensitive, PII may inadvertently be captured and stored. Having structured logs enables quick identification, removal, and protection of sensitive data fields easily; but what about unstructured messages? Or perhaps call center transcriptions?</p>
<p>Elasticsearch, with its long experience in <a href="https://www.elastic.co/what-is/elasticsearch-machine-learning">machine learning</a>, provides various options to bring in custom models, such as large language models (LLMs), and provides its own models. These models will help implement PII redaction.</p>
<p>If you would like to learn more about natural language processing, machine learning, and Elastic, please be sure to check out these related articles:</p>
<ul>
<li><a href="https://www.elastic.co/blog/introduction-to-nlp-with-pytorch-models">Introduction to modern natural language processing with PyTorch in Elasticsearch</a></li>
<li><a href="https://www.elastic.co/blog/how-to-deploy-natural-language-processing-nlp-getting-started">How to deploy natural language processing (NLP): Getting started</a></li>
<li><a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/redact-processor.html">Elastic Redact Processor Documentation</a></li>
<li><a href="https://www.elastic.co/blog/may-2023-launch-sparse-encoder-ai-model">Introducing Elastic Learned Sparse Encoder: Elastic’s AI model for semantic search</a></li>
<li><a href="https://www.elastic.co/blog/may-2023-launch-machine-learning-models">Accessing machine learning models in Elastic</a></li>
</ul>
<p>In this blog, we will show you how to set up PII redaction through the use of Elasticsearch’s ability to load a trained model within machine learning and the flexibility of Elastic’s ingest pipelines.</p>
<p>Specifically, we’ll walk through setting up a <a href="https://www.elastic.co/blog/how-to-deploy-nlp-named-entity-recognition-ner-example">named entity recognition (NER)</a> model for person and location identification, as well as deploying the redact processor for custom data identification and removal. All of this will then be combined with an ingest pipeline where we can use Elastic machine learning and data transformations capabilities to remove sensitive information from your data.</p>
<h2>Loading the trained model</h2>
<p>Before we begin, we must load our NER model into our Elasticsearch cluster. This may be easily accomplished with Docker and the Elastic Eland client. From a command line, let’s install the Eland client via git:</p>
<pre><code class="language-bash">git clone https://github.com/elastic/eland.git
</code></pre>
<p>Navigate into the recently downloaded client:</p>
<pre><code class="language-bash">cd eland/
</code></pre>
<p>Now let’s build the client:</p>
<pre><code class="language-bash">docker build -t elastic/eland .
</code></pre>
<p>From here, you’re ready to deploy the trained model to an Elastic machine learning node! Be sure to replace your username, password, es-cluster-hostname, and esport.</p>
<p>If you’re using the Elastic Cloud or have signed certificates, simply run this command:</p>
<pre><code class="language-bash">docker run -it --rm --network host elastic/eland eland_import_hub_model --url https://&lt;username&gt;:&lt;password&gt;@&lt;es-cluster-hostname&gt;:&lt;esport&gt;/ --hub-model-id dslim/bert-base-NER --task-type ner --start
</code></pre>
<p>If you’re using self-signed certificates, run this command:</p>
<pre><code class="language-bash">docker run -it --rm --network host elastic/eland eland_import_hub_model --url https://&lt;username&gt;:&lt;password&gt;@&lt;es-cluster-hostname&gt;:&lt;esport&gt;/ --insecure --hub-model-id dslim/bert-base-NER --task-type ner --start
</code></pre>
<p>From here you’ll witness the Eland client in action downloading the trained model from <a href="https://huggingface.co/dslim/bert-base-NER">HuggingFace</a> and automatically deploying it into your cluster!</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/remove-pii-data/blog-elastic-huggingface.png" alt="huggingface code" /></p>
<p>Synchronize your newly loaded trained model by clicking on the blue hyperlink via your Machine Learning Overview UI “Synchronize your jobs and trained models.”</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/remove-pii-data/blog-elastic-Machine-Learning-Overview-UI.png" alt="Machine Learning Overview UI" /></p>
<p>Now click the Synchronize button.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/remove-pii-data/blog-elastic-Synchronize-button.png" alt="Synchronize button" /></p>
<p>That’s it! Congratulations, you just loaded your first trained model into Elastic!</p>
<h2>Create the redact processor and ingest pipeline</h2>
<p>From DevTools, let’s configure the redact processor along with our inference processor to take advantage of Elastic’s trained model we just loaded. This will create an ingest pipeline named “redact” that we can then use to remove sensitive data from any field we wish. In this example, I’ll be focusing on the “message” field. Note: at the time of this writing, the redact processor is experimental and must be created via DevTools.</p>
<pre><code class="language-bash">PUT _ingest/pipeline/redact
{
  &quot;processors&quot;: [
    {
      &quot;set&quot;: {
        &quot;field&quot;: &quot;redacted&quot;,
        &quot;value&quot;: &quot;{{{message}}}&quot;
      }
    },
    {
      &quot;inference&quot;: {
        &quot;model_id&quot;: &quot;dslim__bert-base-ner&quot;,
        &quot;field_map&quot;: {
          &quot;message&quot;: &quot;text_field&quot;
        }
      }
    },
    {
      &quot;script&quot;: {
        &quot;lang&quot;: &quot;painless&quot;,
        &quot;source&quot;: &quot;String msg = ctx['message'];\r\n                for (item in ctx['ml']['inference']['entities']) {\r\n                msg = msg.replace(item['entity'], '&lt;' + item['class_name'] + '&gt;')\r\n                }\r\n                ctx['redacted']=msg&quot;
      }
    },
    {
      &quot;redact&quot;: {
        &quot;field&quot;: &quot;redacted&quot;,
        &quot;patterns&quot;: [
          &quot;%{EMAILADDRESS:EMAIL}&quot;,
          &quot;%{IP:IP_ADDRESS}&quot;,
          &quot;%{CREDIT_CARD:CREDIT_CARD}&quot;,
          &quot;%{SSN:SSN}&quot;,
          &quot;%{PHONE:PHONE}&quot;
        ],
        &quot;pattern_definitions&quot;: {
          &quot;CREDIT_CARD&quot;: &quot;\d{4}[ -]\d{4}[ -]\d{4}[ -]\d{4}&quot;,
          &quot;SSN&quot;: &quot;\d{3}-\d{2}-\d{4}&quot;,
          &quot;PHONE&quot;: &quot;\d{3}-\d{3}-\d{4}&quot;
        }
      }
    },
    {
      &quot;remove&quot;: {
        &quot;field&quot;: [
          &quot;ml&quot;
        ],
        &quot;ignore_missing&quot;: true,
        &quot;ignore_failure&quot;: true
      }
    }
  ],
  &quot;on_failure&quot;: [
    {
      &quot;set&quot;: {
        &quot;field&quot;: &quot;failure&quot;,
        &quot;value&quot;: &quot;pii_script-redact&quot;
      }
    }
  ]
}
</code></pre>
<p>OK, but what does each processor really do? Let’s walk through each processor in detail here:</p>
<ol>
<li>
<p>The SET processor creates the field “redacted,” which is copied over from the message field and used later on in the pipeline.</p>
</li>
<li>
<p>The INFERENCE processor calls the NER model we loaded to be used on the message field for identifying names, locations, and organizations.</p>
</li>
<li>
<p>The SCRIPT processor then replaced the detected entities within the redacted field from the message field.</p>
</li>
<li>
<p>Our REDACT processor uses Grok patterns to identify any custom set of data we wish to remove from the redacted field (which was copied over from the message field).</p>
</li>
<li>
<p>The REMOVE processor deletes the extraneous ml.* fields from being indexed; note we’ll add “message” to this processor once we validate data is being redacted properly.</p>
</li>
<li>
<p>The ON_FAILURE / SET processor captures any errors just in case we have them.</p>
</li>
</ol>
<h2>Slice your PII</h2>
<p>Now that your ingest pipeline with all the necessary steps has been configured, let’s start testing how well we can remove sensitive data from documents. Navigate over to Stack Management, select Ingest Pipelines and search for “redact”, and then click on the result.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/remove-pii-data/blog-elastic-Ingest-Pipelines.png" alt="Ingest Pipelines" /></p>
<p>Click on the Manage button, and then click Edit.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/remove-pii-data/elastic-blog-Manage-button.png" alt="Manage button" /></p>
<p>Here we are going to test our pipeline by adding some documents. Below is a sample you can copy and paste to make sure everything is working correctly.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/remove-pii-data/elastic-blog-test-pipeline.png" alt="test pipeline" /></p>
<pre><code class="language-yaml">{
  &quot;_source&quot;:
    {
      &quot;message&quot;: &quot;John Smith lives at 123 Main St. Highland Park, CO. His email address is jsmith123@email.com and his phone number is 412-189-9043.  I found his social security number, it is 942-00-1243. Oh btw, his credit card is 1324-8374-0978-2819 and his gateway IP is 192.168.1.2&quot;,
    },
}
</code></pre>
<p>Simply press the Run the pipeline button, and you will then see the following output:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/remove-pii-data/elastic-blog-pii-output-2.png" alt="pii output code" /></p>
<h2>What’s next?</h2>
<p>After you’ve added this ingest pipeline to a data set you’re indexing and validated that it is meeting expectations, you can add the message field to be removed so that no PII data is indexed. Simply update your REMOVE processor to include the message field and simulate again to only see the redacted field.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/remove-pii-data/elastic-blog-manage-processor.png" alt="" /></p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/remove-pii-data/elastic-blog-pii-output.png" alt="pii output code 2" /></p>
<h2>Conclusion</h2>
<p>With this step-by-step approach, you are now ready and able to detect and redact any sensitive data throughout your indices.</p>
<p>Here’s a quick recap of what we covered:</p>
<ul>
<li>Loading a pre-trained named entity recognition model into an Elastic cluster</li>
<li>Configuring the Redact processor, along with the inference processor, to use the trained model during data ingestion</li>
<li>Testing sample data and modifying the ingest pipeline to safely remove personally identifiable information</li>
</ul>
<p>Ready to get started? Sign up <a href="https://cloud.elastic.co/registration">for Elastic Cloud</a> and try out the features and capabilities I’ve outlined above to get the most value and visibility out of your OpenTelemetry data.</p>
<p><em>The release and timing of any features or functionality described in this post remain at Elastic's sole discretion. Any features or functionality not currently available may not be delivered on time or at all.</em></p>
<p><em>In this blog post, we may have used third party generative AI tools, which are owned and operated by their respective owners. Elastic does not have any control over the third party tools and we have no responsibility or liability for their content, operation or use, nor for any loss or damage that may arise from your use of such tools. Please exercise caution when using AI tools with personal, sensitive or confidential information. Any data you submit may be used for AI training or other purposes. There is no guarantee that information you provide will be kept secure or confidential. You should familiarize yourself with the privacy practices and terms of use of any generative AI tools prior to use.</em></p>
<p><em>Elastic, Elasticsearch and associated marks are trademarks, logos or registered trademarks of Elasticsearch N.V. in the United States and other countries. All other company and product names are trademarks, logos or registered trademarks of their respective owners.</em></p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/remove-pii-data/blog-post4-ai-search-B.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[Gain insights into Kubernetes errors with Elastic Observability logs and OpenAI]]></title>
            <link>https://www.elastic.co/observability-labs/blog/kubernetes-errors-observability-logs-openai</link>
            <guid isPermaLink="false">kubernetes-errors-observability-logs-openai</guid>
            <pubDate>Thu, 18 May 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[This blog post provides an example of how one can analyze error messages in Elasticsearch with ChatGPT using the OpenAI API via Elasticsearch.]]></description>
            <content:encoded><![CDATA[<p>As we’ve shown in previous blogs, Elastic&lt;sup&gt;®&lt;/sup&gt; provides a way to ingest and manage telemetry from the <a href="https://www.elastic.co/blog/kubernetes-cluster-metrics-logs-monitoring">Kubernetes cluster</a> and the <a href="https://www.elastic.co/blog/opentelemetry-observability">application</a> running on it. Elastic provides out-of-the-box dashboards to help with tracking metrics, <a href="https://www.elastic.co/blog/log-management-observability-operations">log management and analytics</a>, <a href="https://www.elastic.co/blog/adding-free-and-open-elastic-apm-as-part-of-your-elastic-observability-deployment">APM functionality</a> (which also supports <a href="https://www.elastic.co/blog/opentelemetry-observability">native OpenTelemetry</a>), and the ability to analyze everything with <a href="https://www.elastic.co/blog/observability-logs-machine-learning-aiops">AIOps features</a> and <a href="https://www.elastic.co/what-is/elasticsearch-machine-learning?elektra=home">machine learning</a> (ML). While you can use pre-existing <a href="https://www.elastic.co/blog/improving-information-retrieval-elastic-stack-search-relevance">ML models in Elastic</a>, <a href="https://www.elastic.co/blog/aiops-automation-analytics-elastic-observability-use-cases">out-of-the-box AIOps features</a>, or your own ML models, there is a need to dig deeper into the root cause of an issue.</p>
<p>Elastic helps reduce the operational work to support more efficient operations, but users still need a way to investigate and understand everything from the cause of an issue to the meaning of specific error messages. As an operations user, if you haven’t run into a particular error before or it's part of some runbook, you will likely go to Google and start searching for information.</p>
<p>OpenAI’s ChatGPT is becoming an interesting generative AI tool that helps provide more information using the models behind it. What if you could use OpenAI to obtain deeper insights (even simple semantics) for an error in your production or development environment? You can easily tie Elastic to OpenAI’s API to achieve this.</p>
<p>Kubernetes, a mainstay in most deployments (on-prem or in a cloud service provider) requires a significant amount of expertise — even if that expertise is to manage a service like GKE, EKS, or AKS.</p>
<p>In this blog, I will cover how you can use <a href="https://www.elastic.co/guide/en/kibana/current/watcher-ui.html">Elastic’s watcher</a> capability to connect Elastic to OpenAI and ask it for more information about the error logs Elastic is ingesting from a Kubernetes cluster(s). More specifically, we will use <a href="https://azure.microsoft.com/en-us/products/cognitive-services/openai-service">Azure’s OpenAI Service</a>. Azure OpenAI is a partnership between Microsoft and OpenAI, so the same models from OpenAI are available in the Microsoft version.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/kubernetes-errors-observability-logs-openai/blog-elastic-azure-openai.png" alt="elastic azure openai" /></p>
<p>While this blog goes over a specific example, it can be modified for other types of errors Elastic receives in logs. Whether it's from AWS, the application, databases, etc., the configuration and script described in this blog can be modified easily.</p>
<h2>Prerequisites and config</h2>
<p>If you plan on following this blog, here are some of the components and details we used to set up the configuration:</p>
<ul>
<li>Ensure you have an account on <a href="http://cloud.elastic.co">Elastic Cloud</a> and a deployed stack (<a href="https://www.elastic.co/guide/en/elastic-stack/current/installing-elastic-stack.html">see instructions here</a>).</li>
<li>We used a GCP GKE Kubernetes cluster, but you can use any Kubernetes cluster service (on-prem or cloud based) of your choice.</li>
<li>We’re also running with a version of the OpenTelemetry Demo. Directions for using Elastic with OpenTelemetry Demo are <a href="https://github.com/elastic/opentelemetry-demo">here</a>.</li>
<li>We also have an Azure account and <a href="https://azure.microsoft.com/en-us/products/cognitive-services/openai-service">Azure OpenAI service configured</a>. You will need to get the appropriate tokens from Azure and the proper URL endpoint from Azure’s OpenAI service.</li>
<li>We will use <a href="https://www.elastic.co/guide/en/kibana/current/devtools-kibana.html">Elastic’s dev tools</a>, the console to be specific, to load up and run the script, which is an <a href="https://www.elastic.co/guide/en/kibana/current/watcher-ui.html">Elastic watcher</a>.</li>
<li>We will also add a new index to store the results from the OpenAI query.</li>
</ul>
<p>Here is the configuration we will set up in this blog:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/kubernetes-errors-observability-logs-openai/blog-elastic-configuration.png" alt="Configuration to analyze Kubernetes cluster errors" /></p>
<p>As we walk through the setup, we’ll also provide the alternative setup with OpenAI versus Azure OpenAI Service.</p>
<h2>Setting it all up</h2>
<p>Over the next few steps, I’ll walk through:</p>
<ul>
<li>Getting an account on Elastic Cloud and setting up your K8S cluster and application</li>
<li>Gaining Azure OpenAI authorization (alternative option with OpenAI)</li>
<li>Identifying Kubernetes error logs</li>
<li>Configuring the watcher with the right script</li>
<li>Comparing the output from Azure OpenAI/OpenAI versus ChatGPT UI</li>
</ul>
<h3>Step 0: Create an account on Elastic Cloud</h3>
<p>Follow the instructions to <a href="https://cloud.elastic.co/registration?fromURI=/home">get started on Elastic Cloud</a>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/kubernetes-errors-observability-logs-openai/blog-elastic-start-cloud-trial.png" alt="elastic start cloud trial" /></p>
<p>Once you have the Elastic Cloud login, set up your Kubernetes cluster and application. A complete step-by-step instructions blog is available <a href="https://www.elastic.co/blog/kubernetes-cluster-metrics-logs-monitoring">here</a>. This also provides an overview of how to see Kubernetes cluster metrics in Elastic and how to monitor them with dashboards.</p>
<h3>Step 1: Azure OpenAI Service and authorization</h3>
<p>When you log in to your Azure subscription and set up an instance of Azure OpenAI Service, you will be able to get your keys under Manage Keys.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/kubernetes-errors-observability-logs-openai/blog-elastic-microsoft-azure-manage-keys.png" alt="microsoft azure manage keys" /></p>
<p>There are two keys for your OpenAI instance, but you only need KEY 1 .</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/kubernetes-errors-observability-logs-openai/blog-elastic-pme-openai-keys-and-endpoint.png" alt="Used with permission from Microsoft." /></p>
<p>Additionally, you will need to get the service URL. See the image above with our service URL blanked out to understand where to get the KEY 1 and URL.</p>
<p>If you are not using Azure OpenAI Service and the standard OpenAI service, then you can get your keys at:</p>
<pre><code class="language-bash">**https** ://platform.openai.com/account/api-keys
</code></pre>
<p><img src="https://www.elastic.co/observability-labs/assets/images/kubernetes-errors-observability-logs-openai/blog-elastic-api-keys.png" alt="api keys" /></p>
<p>You will need to create a key and save it. Once you have the key, you can go to Step 2.</p>
<h3>Step 2: Identifying Kubernetes errors in Elastic logs</h3>
<p>As your Kubernetes cluster is running, <a href="https://docs.elastic.co/en/integrations/kubernetes">Elastic’s Kubernetes integration</a> running on the Elastic agent daemon set on your cluster is sending logs and metrics to Elastic. <a href="https://www.elastic.co/blog/log-monitoring-management-enterprise">The telemetry is ingested, processed, and indexed</a>. Kubernetes logs are stored in an index called .ds-logs-kubernetes.container_logs-default-* (* is for the date), and an automatic data stream logs-kubernetes.container_logs is also pre-loaded. So while you can use some of the out-of-the-box dashboards to investigate the metrics, you can also look at all the logs in Elastic Discover.</p>
<p>While any error from Kubernetes can be daunting, the more nuanced issues occur with errors from the pods running in the kube-system namespace. Take the pod konnectivity agent, which is essentially a network proxy agent running on the node to help establish tunnels and is a vital component in Kubernetes. Any error will cause the cluster to have connectivity issues and lead to a cascade of issues, so it’s important to understand and troubleshoot these errors.</p>
<p>When we filter out for error logs from the konnectivity agent, we see a good number of errors.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/kubernetes-errors-observability-logs-openai/blog-elastic-expanded-document.png" alt="expanded document" /></p>
<p>But unfortunately, we still can’t understand what these errors mean.</p>
<p>Enter OpenAI to help us understand the issue better. Generally, you would take the error message from Discover and paste it with a question in ChatGPT (or run a Google search on the message).</p>
<p>One error in particular that we’ve run into but do not understand is:</p>
<pre><code class="language-bash">E0510 02:51:47.138292       1 client.go:388] could not read stream err=rpc error: code = Unavailable desc = error reading from server: read tcp 10.120.0.8:46156-&gt;35.230.74.219:8132: read: connection timed out serverID=632d489f-9306-4851-b96b-9204b48f5587 agentID=e305f823-5b03-47d3-a898-70031d9f4768
</code></pre>
<p>The OpenAI output is as follows:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/kubernetes-errors-observability-logs-openai/blog-elastic-openai-output.png" alt="openai output" /></p>
<p>ChatGPT has given us a fairly nice set of ideas on why this rpc error is occurring against our konnectivity-agent.</p>
<p>So how can we get this output automatically for any error when those errors occur?</p>
<h3>Step 3: Configuring the watcher with the right script</h3>
<p><a href="https://www.elastic.co/guide/en/kibana/current/watcher-ui.html">What is an Elastic watcher?</a> Watcher is an Elasticsearch feature that you can use to create actions based on conditions, which are periodically evaluated using queries on your data. Watchers are helpful for analyzing mission-critical and business-critical streaming data. For example, you might watch application logs for errors causing larger operational issues.</p>
<p>Once a watcher is configured, it can be:</p>
<ol>
<li>Manually triggered</li>
<li>Run periodically</li>
<li>Created using a UI or a script</li>
</ol>
<p>In this scenario, we will use a script, as we can modify it easily and run it as needed.</p>
<p>We’re using the DevTools Console to enter the script and test it out:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/kubernetes-errors-observability-logs-openai/blog-elastic-test-script.png" alt="test script" /></p>
<p>The script is listed at the end of the blog in the <strong>appendix</strong>. It can also be downloaded <a href="https://github.com/elastic/chatgpt-error-analysis"><strong>here</strong></a> <strong>.</strong></p>
<p>The script does the following:</p>
<ol>
<li>It runs continuously every five minutes.</li>
<li>It will search the logs for errors from the container konnectivity-agent.</li>
<li>It will take the first error’s message, transform it (re-format and clean up), and place it into a variable first_hit.</li>
</ol>
<pre><code class="language-json">&quot;script&quot;: &quot;return ['first_hit': ctx.payload.first.hits.hits.0._source.message.replace('\&quot;', \&quot;\&quot;)]&quot;
</code></pre>
<ol start="4">
<li>The error message is sent into OpenAI with a query:</li>
</ol>
<pre><code class="language-yaml">What are the potential reasons for the following kubernetes error:
  { { ctx.payload.second.first_hit } }
</code></pre>
<ol start="5">
<li>If the search yielded an error, it will proceed to then create an index and place the error message, pod.name (which is konnectivity-agent-6676d5695b-ccsmx in our setup), and OpenAI output into a new index called chatgpt_k8_analyzed.</li>
</ol>
<p>To see the results, we created a new data view called chatgpt_k8_analyzed against the newly created index:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/kubernetes-errors-observability-logs-openai/blog-elastic-edit-data-view.png" alt="edit data view" /></p>
<p>In Discover, the output on the data view provides us with the analysis of the errors.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/kubernetes-errors-observability-logs-openai/blog-elastic-analysis-of-errors.png" alt="analysis of errors" /></p>
<p>For every error the script sees in the five minute interval, it will get an analysis of the error. We could alternatively also use a range as needed to analyze during a specific time frame. The script would just need to be modified accordingly.</p>
<h3>Step 4. Output from Azure OpenAI/OpenAI vs. ChatGPT UI</h3>
<p>As you noticed above, we got relatively the same result from the Azure OpenAI API call as we did by testing out our query in the ChatGPT UI. This is because we configured the API call to run the same/similar model as what was selected in the UI.</p>
<p>For the API call, we used the following parameters:</p>
<pre><code class="language-json">&quot;request&quot;: {
             &quot;method&quot; : &quot;POST&quot;,
             &quot;Url&quot;: &quot;https://XXX.openai.azure.com/openai/deployments/pme-gpt-35-turbo/chat/completions?api-version=2023-03-15-preview&quot;,
             &quot;headers&quot;: {&quot;api-key&quot; : &quot;XXXXXXX&quot;,
                         &quot;content-type&quot; : &quot;application/json&quot;
                        },
             &quot;body&quot; : &quot;{ \&quot;messages\&quot;: [ { \&quot;role\&quot;: \&quot;system\&quot;, \&quot;content\&quot;: \&quot;You are a helpful assistant.\&quot;}, { \&quot;role\&quot;: \&quot;user\&quot;, \&quot;content\&quot;: \&quot;What are the potential reasons for the following kubernetes error: {{ctx.payload.second.first_hit}}\&quot;}], \&quot;temperature\&quot;: 0.5, \&quot;max_tokens\&quot;: 2048}&quot; ,
              &quot;connection_timeout&quot;: &quot;60s&quot;,
               &quot;read_timeout&quot;: &quot;60s&quot;
                            }
</code></pre>
<p>By setting the role: system with You are a helpful assistant and using the gpt-35-turbo url portion, we are essentially setting the API to use the davinci model, which is the same as the ChatGPT UI model set by default.</p>
<p>Additionally, for Azure OpenAI Service, you will need to set the URL to something similar the following:</p>
<pre><code class="language-bash">https://YOURSERVICENAME.openai.azure.com/openai/deployments/pme-gpt-35-turbo/chat/completions?api-version=2023-03-15-preview
</code></pre>
<p>If you use OpenAI (versus Azure OpenAI Service), the request call (against <a href="https://api.openai.com/v1/completions">https://api.openai.com/v1/completions</a>) would be as such:</p>
<pre><code class="language-json">&quot;request&quot;: {
            &quot;scheme&quot;: &quot;https&quot;,
            &quot;host&quot;: &quot;api.openai.com&quot;,
            &quot;port&quot;: 443,
            &quot;method&quot;: &quot;post&quot;,
            &quot;path&quot;: &quot;\/v1\/completions&quot;,
            &quot;params&quot;: {},
            &quot;headers&quot;: {
               &quot;content-type&quot;: &quot;application\/json&quot;,
               &quot;authorization&quot;: &quot;Bearer YOUR_ACCESS_TOKEN&quot;
                        },
            &quot;body&quot;: &quot;{ \&quot;model\&quot;: \&quot;text-davinci-003\&quot;,  \&quot;prompt\&quot;: \&quot;What are the potential reasons for the following kubernetes error: {{ctx.payload.second.first_hit}}\&quot;,  \&quot;temperature\&quot;: 1,  \&quot;max_tokens\&quot;: 512,     \&quot;top_p\&quot;: 1.0,      \&quot;frequency_penalty\&quot;: 0.0,   \&quot;presence_penalty\&quot;: 0.0 }&quot;,
            &quot;connection_timeout_in_millis&quot;: 60000,
            &quot;read_timeout_millis&quot;: 60000
          }
</code></pre>
<p>If you are interested in creating a more OpenAI-based version, you can <a href="https://elastic-content-share.eu/downloads/watcher-job-to-integrate-chatgpt-in-elasticsearch/">download an alternative script</a> and look at <a href="https://mar1.hashnode.dev/unlocking-the-power-of-aiops-with-chatgpt-and-elasticsearch">another blog from an Elastic community member</a>.</p>
<h2>Gaining other insights beyond Kubernetes logs</h2>
<p>Now that the script is up and running, you can modify it using different:</p>
<ul>
<li>Inputs</li>
<li>Conditions</li>
<li>Actions</li>
<li>Transforms</li>
</ul>
<p>Learn more on how to modify it <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/xpack-alerting.html">here</a>. Some examples of modifications could include:</p>
<ol>
<li>Look for error logs from application components (e.g., cartService, frontEnd, from the OTel demo), cloud service providers (e.g., AWS/Azure/GCP logs), and even logs from components such as Kafka, databases, etc.</li>
<li>Vary the time frame from running continuously to running over a specific <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html">range</a>.</li>
<li>Look for specific errors in the logs.</li>
<li>Query for analysis on a set of errors at once versus just one, which we demonstrated.</li>
</ol>
<p>The modifications are endless, and of course you can run this with OpenAI rather than Azure OpenAI Service.</p>
<h2>Conclusion</h2>
<p>I hope you’ve gotten an appreciation for how Elastic Observability can help you connect to OpenAI services (Azure OpenAI, as we showed, or even OpenAI) to better analyze an error log message instead of having to run several Google searches and hunt for possible insights.</p>
<p>Here’s a quick recap of what we covered:</p>
<ul>
<li>Developing an Elastic watcher script that can be used to find and send Kubernetes errors into OpenAI and insert them into a new index</li>
<li>Configuring Azure OpenAI Service or OpenAI with the right authorization and request parameters</li>
</ul>
<p>Ready to get started? Sign up <a href="https://cloud.elastic.co/registration">for Elastic Cloud</a> and try out the features and capabilities I’ve outlined above to get the most value and visibility out of your OpenTelemetry data.</p>
<h2>Appendix</h2>
<p>Watcher script</p>
<pre><code class="language-bash">PUT _watcher/watch/chatgpt_analysis
{
    &quot;trigger&quot;: {
      &quot;schedule&quot;: {
        &quot;interval&quot;: &quot;5m&quot;
      }
    },
    &quot;input&quot;: {
      &quot;chain&quot;: {
          &quot;inputs&quot;: [
              {
                  &quot;first&quot;: {
                      &quot;search&quot;: {
                          &quot;request&quot;: {
                              &quot;search_type&quot;: &quot;query_then_fetch&quot;,
                              &quot;indices&quot;: [
                                &quot;logs-kubernetes*&quot;
                              ],
                              &quot;rest_total_hits_as_int&quot;: true,
                              &quot;body&quot;: {
                                &quot;query&quot;: {
                                  &quot;bool&quot;: {
                                    &quot;must&quot;: [
                                      {
                                        &quot;match&quot;: {
                                          &quot;kubernetes.container.name&quot;: &quot;konnectivity-agent&quot;
                                        }
                                      },
                                      {
                                        &quot;match&quot; : {
                                          &quot;message&quot;:&quot;error&quot;
                                        }
                                      }
                                    ]
                                  }
                                },
                                &quot;size&quot;: &quot;1&quot;
                              }
                            }
                        }
                    }
                },
                {
                    &quot;second&quot;: {
                        &quot;transform&quot;: {
                            &quot;script&quot;: &quot;return ['first_hit': ctx.payload.first.hits.hits.0._source.message.replace('\&quot;', \&quot;\&quot;)]&quot;
                        }
                    }
                },
                {
                    &quot;third&quot;: {
                        &quot;http&quot;: {
                            &quot;request&quot;: {
                                &quot;method&quot; : &quot;POST&quot;,
                                &quot;url&quot;: &quot;https://XXX.openai.azure.com/openai/deployments/pme-gpt-35-turbo/chat/completions?api-version=2023-03-15-preview&quot;,
                                &quot;headers&quot;: {
                                    &quot;api-key&quot; : &quot;XXX&quot;,
                                    &quot;content-type&quot; : &quot;application/json&quot;
                                },
                                &quot;body&quot; : &quot;{ \&quot;messages\&quot;: [ { \&quot;role\&quot;: \&quot;system\&quot;, \&quot;content\&quot;: \&quot;You are a helpful assistant.\&quot;}, { \&quot;role\&quot;: \&quot;user\&quot;, \&quot;content\&quot;: \&quot;What are the potential reasons for the following kubernetes error: {{ctx.payload.second.first_hit}}\&quot;}], \&quot;temperature\&quot;: 0.5, \&quot;max_tokens\&quot;: 2048}&quot; ,
                                &quot;connection_timeout&quot;: &quot;60s&quot;,
                                &quot;read_timeout&quot;: &quot;60s&quot;
                            }
                        }
                    }
                }
            ]
        }
    },
    &quot;condition&quot;: {
      &quot;compare&quot;: {
        &quot;ctx.payload.first.hits.total&quot;: {
          &quot;gt&quot;: 0
        }
      }
    },
    &quot;actions&quot;: {
        &quot;index_payload&quot; : {
            &quot;transform&quot;: {
                &quot;script&quot;: {
                    &quot;source&quot;: &quot;&quot;&quot;
                        def payload = [:];
                        payload.timestamp = new Date();
                        payload.pod_name = ctx.payload.first.hits.hits[0]._source.kubernetes.pod.name;
                        payload.error_message = ctx.payload.second.first_hit;
                        payload.chatgpt_analysis = ctx.payload.third.choices[0].message.content;
                        return payload;
                    &quot;&quot;&quot;
                }
            },
            &quot;index&quot; : {
                &quot;index&quot; : &quot;chatgpt_k8s_analyzed&quot;
            }
        }
    }
}
</code></pre>
<h3>Additional logging resources:</h3>
<ul>
<li><a href="https://www.elastic.co/getting-started/observability/collect-and-analyze-logs">Getting started with logging on Elastic (quickstart)</a></li>
<li><a href="https://www.elastic.co/guide/en/observability/current/logs-metrics-get-started.html">Ingesting common known logs via integrations (compute node example)</a></li>
<li><a href="https://docs.elastic.co/integrations">List of integrations</a></li>
<li><a href="https://www.elastic.co/blog/log-monitoring-management-enterprise">Ingesting custom application logs into Elastic</a></li>
<li><a href="https://www.elastic.co/blog/observability-logs-parsing-schema-read-write">Enriching logs in Elastic</a></li>
<li>Analyzing Logs with <a href="https://www.elastic.co/blog/reduce-mttd-ml-machine-learning-observability">Anomaly Detection (ML)</a> and <a href="https://www.elastic.co/blog/observability-logs-machine-learning-aiops">AIOps</a></li>
</ul>
<h3>Common use case examples with logs:</h3>
<ul>
<li><a href="https://youtu.be/ax04ZFWqVCg">Nginx log management</a></li>
<li><a href="https://www.elastic.co/blog/vpc-flow-logs-monitoring-analytics-observability">AWS VPC Flow log management</a></li>
<li><a href="https://www.elastic.co/blog/kubernetes-errors-observability-logs-openai">Using OpenAI to analyze Kubernetes errors</a></li>
<li><a href="https://youtu.be/Li5TJAWbz8Q">PostgreSQL issue analysis with AIOps</a></li>
</ul>
<p><em>In this blog post, we may have used third party generative AI tools, which are owned and operated by their respective owners. Elastic does not have any control over the third party tools and we have no responsibility or liability for their content, operation or use, nor for any loss or damage that may arise from your use of such tools. Please exercise caution when using AI tools with personal, sensitive or confidential information. Any data you submit may be used for AI training or other purposes. There is no guarantee that information you provide will be kept secure or confidential. You should familiarize yourself with the privacy practices and terms of use of any generative AI tools prior to use.</em></p>
<p><em>Elastic, Elasticsearch and associated marks are trademarks, logos or registered trademarks of Elasticsearch N.V. in the United States and other countries. All other company and product names are trademarks, logos or registered trademarks of their respective owners.</em></p>
<p><em>Screenshots of Microsoft products used with permission from Microsoft.</em></p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/kubernetes-errors-observability-logs-openai/blog-elastic-configuration.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[Troubleshooting your Agents and Amazon Bedrock AgentCore with Elastic Observability]]></title>
            <link>https://www.elastic.co/observability-labs/blog/llm-agentic-ai-observability-amazon-bedrock-agentcore</link>
            <guid isPermaLink="false">llm-agentic-ai-observability-amazon-bedrock-agentcore</guid>
            <pubDate>Mon, 01 Dec 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[Discover how to achieve end-to-end observability for Amazon Bedrock AgentCore: from tracking service health and token costs to debugging complex reasoning loops with distributed tracing.]]></description>
            <content:encoded><![CDATA[<h2>Troubleshooting your Agents and Amazon Bedrock AgentCore with Elastic Observability</h2>
<h3>Introduction</h3>
<p>We're excited to introduce Elastic Observability’s Amazon Bedrock AgentCore integration, which allows users to observe <a href="https://aws.amazon.com/bedrock/agentcore/">Amazon Bedrock AgentCore</a> and the agents' LLM interactions end-to-end. Agentic AI represents a fundamental shift in how we build applications. </p>
<p>Unlike standard LLM chatbots that simply generate text, agents can reason, plan, and execute multi-step workflows to complete complex tasks autonomously. Many times these agents are running on a platform such as Amazon Bedrock AgentCore, which helps developers build, deploy and scale agents. Amazon Bedrock AgentCore is Amazon Bedrock's platform providing the secure, scalable, and modular infrastructure services (like agent runtime, memory, and identity) necessary for developers to deploy and operate highly capable AI agents built with any framework or model.</p>
<p>Using a platform, such as Amazon Bedrock Agentcore, is easy, but troubleshooting an agent is far more complex than debugging a standard microservice. Key challenges include:</p>
<ul>
<li>
<p><strong>Non-Deterministic Behavior:</strong> Agents may choose different tools or reasoning paths for the same prompt, making it difficult to reproduce bugs.</p>
</li>
<li>
<p><strong>&quot;Black Box&quot; Execution:</strong> When an agent fails or provides a hallucinated answer, it is often unclear if the issue lies in the LLM's reasoning, the context provided, or a failed tool execution.</p>
</li>
<li>
<p><strong>Cost &amp; Latency Blind Spots:</strong> A single user query can trigger recursive loops or expensive multi-step tool calls, leading to unexpected spikes in token usage and latency.</p>
</li>
</ul>
<p>To effectively observe these systems, you need to correlate signals from two distinct layers:</p>
<ol>
<li>
<p><strong>The Platform Layer (Amazon Bedrock AgentCore):</strong> You need to understand the overall health of the managed service. This includes high-level metrics like invocation counts, latency, throttling, and platform-level errors that affect all agents running in AgentCore.</p>
</li>
<li>
<p><strong>The Application Layer (Your Agentic Logic):</strong> You want to understand the granular &quot;why&quot; behind the behavior. This includes distributed traces, usually with OpenTelemetry, that visualize the full request lifecycle (e.g. waterfall view), identifying exactly which step in the reasoning chain failed or took too long.</p>
</li>
</ol>
<p><strong>Agentic AI Observability in Elastic</strong> provides a unified, end-to-end view of your agentic deployment by combining platform-level insights from Amazon Bedrock AgentCore, through the new <a href="https://www.elastic.co/docs/reference/integrations/aws_bedrock_agentcore">Amazon Bedrock AgentCore integration</a>, with deep application-level visibility from OpenTelemetry (OTel) traces, logs and metrics form the agent. This unified view in Elastic allows you to observe, troubleshoot, and optimize your agentic applications from end to end without switching tools. Additionally, Elastic provides Agent Builder which allows you to create agents to analyze any of the data from Amazon Bedrock AgentCore and the agents running on it.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-agentic-ai-observability-amazon-bedrock-agentcore/amazon-bedrock-agentcore-dashboard-runtime-gateway-traces.jpg" alt="Amazon Bedrock AgentCore Dashboards for Runtime and Gateway and APM Tracing" /></p>
<h2>Agentic AI Observability in Elastic</h2>
<p>As mentioned above there are two main parts to end-to-end Agentic AI Observability in Elastic.</p>
<ul>
<li>
<p><strong>Amazon Bedrock AgentCore Platform Observability -</strong> using platform logs and metrics,  Elastic provides comprehensive visibility into the high-level health of the AgentCore service by ingesting AWS vended logs and metrics across four critical components:</p>
<ul>
<li>
<p><strong>Runtime:</strong> Monitor core performance indicators such as agent errors, overall latency, throttle counts, and invocation rates, for each endpoint. </p>
</li>
<li>
<p><strong>Gateway:</strong> specific insights into gateway and tool call performance, including invocations, error rates, and latency.</p>
</li>
<li>
<p><strong>Memory:</strong> Track short-term and long-term memory operations, including event creation, retrieval, and listing, alongside performance analysis, errors, and latency metrics.</p>
</li>
<li>
<p><strong>Identity:</strong> Audit security and access health with logs on successful and failed access attempts.</p>
</li>
</ul>
</li>
</ul>
<ul>
<li><strong>Agent Observability with APM, logs and metrics -</strong> To understand <em>how</em> your agent is behaving, Elastic ingests OTel-native traces, metrics and logs from your application running within AgentCore. This allows you to visualize the full execution path, including LLM reasoning steps and tool calls, in a detailed waterfall diagram. </li>
</ul>
<ul>
<li><strong>Agentic AI Analysis</strong> - All of the data from Amazon Bedrock AgentCore and the agent running on it, can be analyzed with <strong>Elastic’s AI driven capabilities</strong>. These include:</li>
</ul>
<ul>
<li>
<p><strong>Elastic AgentCore SRE Agent built on Elastic Agent Builder</strong> - We don't just monitor agents; we provide you with one to assist your team. The <strong>AgentCore SRE Agent</strong> is a specialized assistant built using <strong>Elastic Agent Builder</strong>. It possesses specialized knowledge of AgentCore applications observed in Elastic.</p>
<ul>
<li>
<p><strong>How it helps:</strong> You can ask specific questions regarding your AgentCore environment, such as how to interpret a complex error log or why a specific trace shows latency.</p>
</li>
<li>
<p><strong>Get the Agent:</strong> You can deploy this agent yourself from our <a href="https://github.com/elastic/observability-examples/tree/main/aws/amazon-bedrock-agentcore/elastic_agentcore_sre_agent">GitHub repository</a>.</p>
</li>
</ul>
</li>
<li>
<p><strong>Elastic Observability AI Assistant</strong> - Use natural language anywhere in Elastic’s UI to help you pinpoint issues, analyze something specific, or just learn what the problem is through LLM knowledge base. Additionally, SREs can interpret log messages, errors, metrics patterns, optimize code, write reports, and even identify and execute a runbook, or find a related github issue.</p>
</li>
<li>
<p><strong>Streams -</strong> AI-Driven Log Analysis - When you send AgentCore logs from your instrumented application into Elastic, you can parse and analyze them. Additionally, Streams finds <strong>Significant Events</strong> within your log stream allowing you to focus immediately on what matters most.</p>
</li>
<li>
<p><strong>Dashboards and ES|QL</strong> Data is only useful if you can act on it. Elastic provides out-of-the-box (OOTB) assets to accelerate your mean time to resolution (MTTR). And Elastic provides ES|QL to help you perform ad-hoc analysis on any signal</p>
<ul>
<li>
<p><strong>OOTB Dashboards:</strong> Pre-built visualizations based on AgentCore service signals. These dashboards provide an immediate, high-level overview of the usage, health, and performance of your AgentCore runtime, gateway, memory, and identity components.</p>
</li>
<li>
<p><strong>OOTB Alert Templates:</strong> Pre-configured alerts for common agentic issues (e.g., high error rates, latency spikes, or unusual token consumption), allowing you to move from reactive to proactive troubleshooting immediately.</p>
</li>
</ul>
</li>
</ul>
<h2>Onboarding Amazon Bedrock AgentCore signals into Elastic</h2>
<h3> Amazon Bedrock AgentCore Integration</h3>
<p>To get started with platform-level visibility, you need to enable the <strong>Amazon Bedrock AgentCore</strong> integration in Elastic. This integration automatically collects metrics and logs from your AgentCore runtime, gateway, memory, and identity components via Amazon CloudWatch.</p>
<p><strong>Setup Steps:</strong></p>
<ol>
<li>
<p><strong>Prepare AWS Environment:</strong> Ensure your AgentCore agents are deployed and running and that you have enabled logging on your AgentCore resources in the AWS console.</p>
</li>
<li>
<p><strong>Add the Integration:</strong></p>
<ul>
<li>
<p>In Elastic (Kibana), navigate to <strong>Integrations</strong>.</p>
</li>
<li>
<p>Search for <strong>&quot;Amazon Bedrock AgentCore&quot;</strong>. Select <strong>Add Amazon Bedrock AgentCore</strong>.</p>
</li>
</ul>
</li>
<li>
<p><strong>Configure &amp; Deploy:</strong></p>
<p>Configure Elastic's Amazon Bedrock AgentCore integration to collect CloudWatch metrics from your chosen AWS region at the specified collection interval. Logs will be added soon after the publication of this blog.</p>
</li>
</ol>
<h3>Onboard the Agent with OTel Instrumentation</h3>
<p>The next step is observing the application logic itself. The beauty of Amazon Bedrock AgentCore is that the application runtime often comes pre-instrumented. You simply need to tell it where to send the telemetry data.</p>
<p>For this example, we will use the <a href="https://github.com/elastic/observability-examples/tree/main/aws/amazon-bedrock-agentcore/travel_assistant"><strong>Travel Assistant</strong></a> from the Elastic Observability examples.</p>
<p>To instrument this agent, you do not need to modify the source code. Instead, when you invoke the agent using the <code>agentcore</code> CLI, you simply pass your Elastic connection details as environment variables. This redirects the OTel signals (traces, metrics, and logs) directly to the Elastic EDOT collector.</p>
<p><strong>Example Invoke Command:</strong> Run the following command to launch the agent and start streaming telemetry to Elastic:</p>
<pre><code class="language-bash">    agentcore launch \
    --env BEDROCK_MODEL_ID=&quot;us.anthropic.claude-3-5-sonnet-20240620-v1:0&quot; \
    --env OTEL_EXPORTER_OTLP_ENDPOINT=&quot;https://&lt;REPLACE_WITH_ELASTIC_ENDPOINT&gt;.region.cloud.elastic.co:443&quot; \
    --env OTEL_EXPORTER_OTLP_HEADERS=&quot;Authorization=ApiKey &lt;REPLACE_WITH_YOUR_API_KEY&gt;&quot; \
    --env OTEL_EXPORTER_OTLP_PROTOCOL=&quot;http/protobuf&quot; \
    --env OTEL_METRICS_EXPORTER=&quot;otlp&quot; \
    --env OTEL_TRACES_EXPORTER=&quot;otlp&quot; \
    --env OTEL_LOGS_EXPORTER=&quot;otlp&quot; \
    --env OTEL_RESOURCE_ATTRIBUTES=&quot;service.name=travel_assistant,service.version=1.0.0&quot; \
    --env AGENT_OBSERVABILITY_ENABLED=&quot;true&quot; \
    --env DISABLE_ADOT_OBSERVABILITY=&quot;true&quot; \
    --env TAVILY_API_KEY=&quot;&lt;REPLACE_WITH_YOUR_TAVILY_KEY&gt;&quot;
</code></pre>
<p><strong>Key Configuration Parameters:</strong></p>
<ul>
<li>
<p><code>OTEL_EXPORTER_OTLP_ENDPOINT</code>: Your Elastic OTLP endpoint (ensure port 443 is specified).</p>
</li>
<li>
<p><code>OTEL_EXPORTER_OTLP_HEADERS</code>: The Authorization header containing your Elastic API Key.</p>
</li>
<li>
<p><code>DISABLE_ADOT_OBSERVABILITY=true</code>: This ensures the native AgentCore signals are routed exclusively to your defined endpoint (Elastic) rather than default AWS paths.</p>
</li>
</ul>
<h2>Analyzing Agentic Data in Elastic Observability</h2>
<p>As we walk through the analysis features below, we will use the Travel Assistant agent which we instrumented earlier as well as any other apps you may be running on AgentCore. For the purposes of this example, as a second agent, we will use <a href="https://github.com/awslabs/amazon-bedrock-agentcore-samples/tree/main/02-use-cases/customer-support-assistant"><strong>Customer Support Assistant</strong></a> from the AWS Labs AgentCore samples </p>
<h3>Out-of-the-Box (OOTB) Dashboards</h3>
<p>Elastic populates a set of comprehensive dashboards based on Amazon Bedrock AgentCore service logs and metrics. These appear as a unified view with tabs, providing a &quot;single pane of glass&quot; into the operational health of your platform.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-agentic-ai-observability-amazon-bedrock-agentcore/amazon-bedrock-agentcore-integration-dashboards-runtime-gateway-memory-identity.gif" alt="Amazon Bedrock AgentCore out-of-the-box Dashboards for Runtime, Gateway, Memory and Identity" /></p>
<p>This view is divided into four key zones, each addressing specific components of AgentCore - Runtime, Gateway, Memory, Identity. Note that note all agentic applications use all 4 components. In our example only the Customer Assistant uses all four components, whereas the Travel agent uses only Runtime. </p>
<p><strong>Runtime Health</strong></p>
<hr />
<p>Visualize agent invocations, session metrics, error trends (system vs. user), and performance stats like latency and throttling, split per endpoint. This dashboard helps you answer questions like</p>
<ul>
<li>&quot;How are my Travel Assistant agent and Customer Support agent performing in terms of overall traffic and latency, and are there any spikes in errors or throttling?&quot;</li>
</ul>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-agentic-ai-observability-amazon-bedrock-agentcore/amazon-bedrock-agentcore-runtime-dashboard.jpg" alt="Amazon Bedrock AgentCore out-of-the-box Dashboard for AgentCore Runtime" /></p>
<p><strong>Gateway Performance</strong></p>
<hr />
<p>Analyze invocations across Lambda and MCP (Model Context Protocol), with detailed breakdowns for tool vs. non-tool calls. The dashboard highlights throttling detection, target execution times, and separates system errors from user errors.</p>
<ul>
<li><em>Question answered:</em> &quot;Are my external integrations (Lambda, MCP) performing efficiently, or are specific tool calls experiencing high latency, throttling, or system-level errors?&quot;</li>
</ul>
<p><strong>Memory Operations</strong></p>
<hr />
<p>Track core operations like event creation, retrieval, and listing, alongside deep dives into long-term memory processing. This includes extraction and consolidation metrics broken down by strategy type, as well as specific monitoring for throttling and system vs. user errors.</p>
<ul>
<li><em>Question answered:</em> &quot;Are failures in memory consolidation strategies or high retrieval latency preventing the agent from effectively recalling user context?&quot;</li>
</ul>
<p><strong>Identity &amp; Access</strong></p>
<hr />
<p>Monitor identity token fetch operations (workload, OAuth, API keys) and real-time authentication success/failure rates. The dashboard breaks down activity by provider and highlights throttling or capacity bottlenecks.</p>
<ul>
<li><em>Question answered:</em> &quot;Are authentication failures or token fetch bottlenecks from specific providers preventing agents from accessing required resources?&quot;</li>
</ul>
<h3>Out-of-the-Box (OOTB) Alert Templates</h3>
<p>Observability isn't just about looking at dashboards; it's about knowing when to act. To move from reactive checking to proactive monitoring, Elastic provides <strong>OOTB Alert Rule Templates</strong> (starting with Elastic version 9.2.1).</p>
<p>These templates eliminate guesswork by pre-selecting the optimal metrics to monitor and applying sensible thresholds. This configuration focuses on high-fidelity alerts for genuine anomalies, helping you catch critical issues early while minimizing alert fatigue.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-agentic-ai-observability-amazon-bedrock-agentcore/elastic-alert-rule-templates-for-amazon-bedrock-agentcore.jpg" alt="Amazon Bedrock AgentCore out-of-the-box Alert rule templates for AgentCore" /></p>
<p><strong>Suggested OOTB Alerts:</strong></p>
<ul>
<li>
<p><strong>Agent Runtime System Errors:</strong> Detects server-side errors (500 Internal Server Error) during agent runtime invocations, indicating infrastructure or service issues with AWS Bedrock AgentCore.</p>
</li>
<li>
<p><strong>Agent Runtime User Errors:</strong> Flags client-side errors (4xx) during agent runtime invocations, including validation failures (400), resource not found (404), access denied (403), and resource conflicts (409). This helps catch misconfigured permissions, invalid input, or missing resources early.</p>
</li>
<li>
<p><strong>Agent Runtime High Latency:</strong> Triggers when the average latency for agent runtime invocations exceeds 10 seconds (10,000ms). Latency measures the time elapsed between receiving a request and sending the final response token.</p>
</li>
</ul>
<h3> APM Tracing</h3>
<p>While logs and metrics tell you <em>that</em> an issue exists, <strong>APM Tracing</strong> tells you exactly <em>where</em> and <em>why</em> it is happening. By ingesting the OpenTelemetry signals from your instrumented agent, Elastic generates a detailed distributed trace (e.g. waterfall view) for every interaction. To get further details on LLM information such as prompts, responses, token usage, etc, you can explore the APM logs.  </p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-agentic-ai-observability-amazon-bedrock-agentcore/otel-native-strands-agent-traces-in-elastic-apm.jpg" alt="Amazon Bedrock AgentCore OTel-nativedistributed tracing waterfall diagram in Elastic APM" /></p>
<p>This allows you to peer inside the &quot;black box&quot; of the agent's execution flow:</p>
<ul>
<li>
<p><strong>Visualize the Chain of Thought:</strong> See the full sequence of events, from the user's initial prompt to the final response, including all intermediate reasoning steps.</p>
</li>
<li>
<p><strong>Pinpoint Tool Failures:</strong> Identify exactly which external tool (e.g., a Lambda function for flight booking or a knowledge base query) failed or timed out.</p>
</li>
<li>
<p><strong>Analyze Latency Contributors:</strong> Distinguish between latency caused by the LLM's generation time versus latency caused by slow downstream API calls.</p>
</li>
<li>
<p><strong>Debug with Context:</strong> Drill down into individual spans to see specific error messages, attributes, and metadata that explain why a particular step failed.</p>
</li>
</ul>
<h3>Conclusion</h3>
<p>As organizations move from experimental chatbots to complex, autonomous agents in production, the need for robust observability has never been greater. Agentic applications introduce new layers of complexity—non-deterministic behaviors, multi-step reasoning loops, and cost implications—that standard monitoring tools simply cannot see.</p>
<p>Elastic Agentic AI Observability for Amazon Bedrock AgentCore bridges this gap. By unifying platform-level health metrics from AgentCore with deep, transaction-level distributed tracing from OpenTelemetry, Elastic gives SREs and developers the complete picture. Whether you are debugging a failed tool call, optimizing latency, or controlling token costs, you have the visibility needed to run agentic AI with confidence.</p>
<p><strong>Complete Visibility: AgentCore + Amazon Bedrock:</strong> For the most comprehensive view, we recommend onboarding Elastic’s <a href="https://www.elastic.co/docs/reference/integrations/aws_bedrock"><strong>Amazon Bedrock</strong> integration</a> alongside AgentCore. While the AgentCore integration focuses on the orchestration layer—monitoring agent errors, tool latency, and invocations—the Bedrock integration provides deep visibility into the underlying foundation models themselves. This includes tracking model-specific latency, token usage, full prompts and responses, and even <strong>Guardrails</strong> usage and effectiveness. By combining both, you ensure complete coverage from the high-level agent workflow down to the raw model inference.</p>
<ul>
<li>
<p><strong>Read more:</strong><a href="https://www.elastic.co/observability-labs/blog/llm-observability-aws-bedrock"> Monitor Amazon Bedrock with Elastic</a></p>
</li>
<li>
<p><strong>Read more:</strong><a href="https://www.elastic.co/observability-labs/blog/llm-observability-amazon-bedrock-guardrails"> Amazon Bedrock Guardrails Observability</a></p>
</li>
</ul>
<p><strong>Get Started Today</strong> Ready to see your agents in action?</p>
<ul>
<li>
<p><strong>Try it out:</strong> Log in to <a href="https://cloud.elastic.co/login">Elastic Cloud</a> and add the Amazon Bedrock AgentCore integration. Or use <a href="https://aws.amazon.com/marketplace/seller-profile?id=d8f59038-c24c-4a9d-a66d-6711d35d7305">Elastic from Amazon Marketplace</a></p>
</li>
<li>
<p><strong>Explore the Code:</strong> Check out our GitHub repository for the <a href="https://github.com/elastic/observability-examples/tree/main/aws/amazon-bedrock-agentcore/travel_assistant">Travel assistant</a> which you saw in this blog, as well as the <a href="https://github.com/elastic/observability-examples/tree/main/aws/amazon-bedrock-agentcore/elastic_agentcore_sre_agent">AgentCore SRE Agent</a>.</p>
</li>
<li>
<p><strong>Learn More:</strong> Read the <a href="https://www.elastic.co/docs/reference/integrations/aws_bedrock_agentcore">full documentation</a> on setting up integration for Agentic AI Observability for Amazon Bedrock AgentCore.</p>
</li>
</ul>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/llm-agentic-ai-observability-amazon-bedrock-agentcore/agentcore-blog.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[LLM observability with Elastic: Taming the LLM with Guardrails for Amazon Bedrock]]></title>
            <link>https://www.elastic.co/observability-labs/blog/llm-observability-amazon-bedrock-guardrails</link>
            <guid isPermaLink="false">llm-observability-amazon-bedrock-guardrails</guid>
            <pubDate>Sun, 02 Mar 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[Elastic’s enhanced Amazon Bedrock integration for Observability now includes Guardrails monitoring, offering real-time visibility into AI safety mechanisms. Track guardrail performance, usage, and policy interventions with pre-built dashboards. Learn how to set up observability for Guardrails and monitor key signals to strengthen safeguards against hallucinations, harmful content, and policy violations.]]></description>
            <content:encoded><![CDATA[<p>In a previous <a href="https://www.elastic.co/observability-labs/blog/llm-observability-aws-bedrock">blog</a> we showed you how to set up observability for your models hosted on Amazon Bedrock using Elastic’s integration. You can now effortlessly enable observability for your Amazon Bedrock guardrails using the enhanced <a href="https://www.elastic.co/guide/en/integrations/current/aws_bedrock.html">Elastic Amazon Bedrock integration</a>. If you previously onboarded the Amazon Bedrock integration, just upgrade it and you will automatically get all guardrails-related updates. The enhanced integration provides a single pane of glass dashboard with two panels - one focusing on overall Bedrock visualizations as well as a separate panel dedicated to Guardrails. You can now ingest and visualize metrics and logs specific to Guardrails, such as guardrail invocation count, invocation latency, text unit utilization, guardrail policy types associated with interventions and many more.</p>
<p>In this blog we will show you how to set up observability for Amazon Bedrock Guardrails, how you can make use of the enhanced dashboards and what key signals to alert on for an effective observability coverage of your Bedrock guardrails.</p>
<h2>Prerequisites</h2>
<p>To follow along with this blog, please make sure you have:</p>
<ul>
<li>An account on <a href="http://cloud.elastic.co/">Elastic Cloud</a> and a deployed stack in AWS (<a href="https://www.elastic.co/guide/en/elastic-stack/current/installing-elastic-stack.html">see instructions here</a>). Ensure you are using version 8.16.2 or higher. Alternatively, you can use <a href="https://www.elastic.co/cloud/serverless">Elastic Cloud Serverless</a>, a fully managed solution that eliminates infrastructure management, automatically scales based on usage, and lets you focus entirely on extracting value from your data.</li>
<li>An AWS account with permissions to pull the necessary data from AWS. See <a href="https://docs.elastic.co/en/integrations/aws#aws-permissions">details in our documentation</a>.</li>
</ul>
<h2>Steps to create a guardrail for Amazon Bedrock</h2>
<p>Before you set up observability for the guardrails, ensure that you have configured guardrails for your model. Follow the steps below to create an Amazon Bedrock Guardrail</p>
<ol>
<li><strong>Access the Amazon Bedrock Console</strong>
<ul>
<li>Sign in to the AWS Management Console with appropriate permissions and navigate to the Amazon Bedrock console.</li>
</ul>
</li>
<li><strong>Navigate to Guardrails</strong>
<ul>
<li>From the left-hand menu, select <strong>Guardrails</strong>.</li>
</ul>
</li>
<li><strong>Create a New Guardrail</strong>
<ul>
<li>Select <strong>Create guardrail</strong>.</li>
<li>Provide a descriptive name, an optional brief description, and specify a message to display when the guardrail blocks the user prompt.
<ul>
<li>Example: <em>Sorry, I am not configured to answer such questions. Kindly ask a different question.</em></li>
</ul>
</li>
</ul>
</li>
<li><strong>Configure Guardrail Policies</strong>
<ul>
<li><strong>Content Filters</strong>: Adjust settings to block harmful content and prompt attacks.</li>
<li><strong>Denied Topics</strong>: Specify topics to block.</li>
<li><strong>Word Filters</strong>: Define specific words or phrases to block.</li>
<li><strong>Sensitive Information Filters</strong>: Set up filters to detect and remove sensitive information.</li>
<li><strong>Contextual Grounding</strong>:
<ul>
<li>Configure the <strong>Grounding Threshold</strong> to set the minimum confidence level for factual accuracy.</li>
<li>Set the <strong>Relevance Threshold</strong> to ensure responses align with user queries.</li>
</ul>
</li>
</ul>
</li>
<li><strong>Review and Create</strong>
<ul>
<li>Review your settings and select <strong>Create</strong> to finalize the guardrail.</li>
</ul>
</li>
<li><strong>Create a Guardrail Version</strong>
<ul>
<li>In the <strong>Version</strong> section, select <strong>Create</strong>.</li>
<li>Optionally add a description, then select <strong>Create Version</strong>.</li>
</ul>
</li>
</ol>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-amazon-bedrock-guardrails/guardrails-policy-configuration.png" alt="Amazon Bedrock Guardrails Policy Configurations" /></p>
<p>After creating a version of your guardrail, it's important to note down the <strong>Guardrail ID</strong> and the <strong>Guardrail Version Name</strong>. These identifiers are essential when integrating the guardrail into your application, as you'll need to specify them during guardrail invocation.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-amazon-bedrock-guardrails/guardrails-creation-confirmations.png" alt="Amazon Bedrock Guardrails Policy Version" /></p>
<h2>Example code to integrate with Amazon Bedrock guardrails</h2>
<p>Integrating Amazon Bedrock's ChatBedrock into your Python application enables advanced language model interactions with customisable safety measures. By configuring guardrails, you can ensure that the model adheres to predefined policies, preventing it from generating inappropriate or sensitive content.</p>
<p>The following code demonstrates how to integrate Amazon Bedrock with guardrails to enforce contextual grounding in AI-generated responses. It sets up a Bedrock client using AWS credentials, defines a reference grounding statement, and uses the ChatBedrock API to process user queries with contextual constraints. The <strong>converse_with_guardrails</strong> function sends a user query alongside a predefined grounding reference, ensuring that responses align with the provided knowledge source.</p>
<h3>Setting Up Environment Variables</h3>
<p>Before running the script, configure the required <strong>AWS credentials</strong> and <strong>guardrail settings</strong> as environment variables. These variables allow the script to authenticate with Amazon Bedrock and apply the necessary guardrails for safe and controlled AI interactions.</p>
<p>Create a <strong>.env</strong> file in the same directory as your script and add:</p>
<pre><code class="language-bash">AWS_ACCESS_KEY=&quot;your-access-key&quot; 
AWS_SECRET_KEY=&quot;your-secret-key&quot; 
AWS_REGION=&quot;your-aws-region&quot; 
GUARDRAIL_ID=&quot;your-guardrail-id&quot; 
GUARDRAIL_VERSION=&quot;your-guardrail-version&quot;
</code></pre>
<h3>Create a Python script and run</h3>
<p>Create a Python script using the code below and execute it to interact with the Amazon Bedrock Guardrails you set up.</p>
<pre><code class="language-python">import os
import boto3
from dotenv import load_dotenv
from langchain_aws import ChatBedrock
import json
from botocore.exceptions import ClientError

# Load environment variables
load_dotenv()

# Function to check for hallucinations using contextual grounding
def check_hallucination(response):
   output_assessments = response.get(&quot;trace&quot;, {}).get(&quot;guardrail&quot;, {}).get(&quot;outputAssessments&quot;, {})

   # Iterate over all assessments
   for key, assessments in output_assessments.items():
       for assessment in assessments:
           contextual_policy = assessment.get(&quot;contextualGroundingPolicy&quot;, {})
          
           if &quot;filters&quot; in contextual_policy:
               grounding = relevance = None
               grounding_threshold = relevance_threshold = None

               for filter_result in contextual_policy[&quot;filters&quot;]:
                   filter_type = filter_result.get(&quot;type&quot;)
                   if filter_type == &quot;RELEVANCE&quot;:
                       relevance = filter_result.get(&quot;score&quot;, 0)
                       relevance_threshold = filter_result.get(&quot;threshold&quot;, 0)
                   elif filter_type == &quot;GROUNDING&quot;:
                       grounding = filter_result.get(&quot;score&quot;, 0)
                       grounding_threshold = filter_result.get(&quot;threshold&quot;, 0)
          
           if relevance &lt; relevance_threshold or grounding &lt; grounding_threshold:
               return True, relevance, grounding, relevance_threshold, grounding_threshold  # Hallucination detected
  
   return False, relevance, grounding, relevance_threshold, grounding_threshold  # No hallucination detected

def converse_with_guardrails(bedrock_client, messages, grounding_reference):
   message = [
       {
           &quot;role&quot;: &quot;user&quot;,
           &quot;content&quot;: [
               {
                   &quot;guardContent&quot;: {
                       &quot;text&quot;: {
                           &quot;text&quot;: grounding_reference,
                           &quot;qualifiers&quot;: [&quot;grounding_source&quot;],
                       }
                   }
               },
               {
                   &quot;guardContent&quot;: {
                       &quot;text&quot;: {
                           &quot;text&quot;: messages,
                           &quot;qualifiers&quot;: [&quot;query&quot;],
                       }
                   }
               },
           ],
       }
   ]
   converse_config = {
       &quot;modelId&quot;: os.getenv('CHAT_MODEL'),
       &quot;messages&quot;: message,
       &quot;guardrailConfig&quot;: {
           &quot;guardrailIdentifier&quot;: os.getenv(&quot;GUARDRAIL_ID&quot;),
           &quot;guardrailVersion&quot;: os.getenv(&quot;GUARDRAIL_VERSION&quot;),
           &quot;trace&quot;: &quot;enabled&quot;
       },
       &quot;inferenceConfig&quot;: {
           &quot;temperature&quot;: 0.5       
       },
   }
   try:
       response = bedrock_client.converse(**converse_config)
       return response
   except ClientError as e:
       error_message = e.response['Error']['Message']
       print(f&quot;An error occurred: {error_message}&quot;)
       print(&quot;Converse config:&quot;)
       print(json.dumps(converse_config, indent=2))
       return None
  
def pretty_print_response(response, is_hallucination, relevance, relevance_threshold, grounding, grounding_threshold):
   print(&quot;\n&quot; + &quot;=&quot;*60)
   print(&quot; Guardrail Assessment&quot;)
   print(&quot;=&quot;*60)
   # Extract response message safely
   response_text = response.get(&quot;output&quot;, {}).get(&quot;message&quot;, {}).get(&quot;content&quot;, [{}])[0].get(&quot;text&quot;, &quot;N/A&quot;)
   print(&quot;\n **Model Response:**&quot;)
   print(f&quot;   {response_text}&quot;)
   print(&quot;\n **Guardrail Assessment:**&quot;)
   print(f&quot;   Is Hallucination : {is_hallucination}&quot;)
   print(&quot;\n **Contextual Grounding Policy Scores:**&quot;)
   print(f&quot;   - Relevance Score : {relevance:.2f} (Threshold: {relevance_threshold:.2f})&quot;)
   print(f&quot;   - Grounding Score : {grounding:.2f} (Threshold: {grounding_threshold:.2f})&quot;)
   print(&quot;\n&quot; + &quot;=&quot;*60 + &quot;\n&quot;)
  
def main():
   bs = boto3.Session(
       aws_access_key_id=os.getenv('AWS_ACCESS_KEY'),
       aws_secret_access_key=os.getenv('AWS_SECRET_KEY'),
       region_name=os.getenv('AWS_REGION')
   )

   # Initialize Bedrock client
   bedrock_client = bs.client(&quot;bedrock-runtime&quot;)

   # Grounding reference
   grounding_reference = &quot;The Wright brothers made the first powered aircraft flight on December 17, 1903.&quot;

   # User query
   user_query = &quot;Who were the first to fly an airplane?&quot;
  
   # Get model response
   response = converse_with_guardrails(bedrock_client, user_query, grounding_reference)

   # Check for hallucinations
   is_hallucination, relevance, grounding, relevance_threshold, grounding_threshold = check_hallucination(response)

   # Print the results
   pretty_print_response(response, is_hallucination, relevance, relevance_threshold, grounding, grounding_threshold)


if __name__ == &quot;__main__&quot;:
   main()
</code></pre>
<h3>Identifying Hallucinations with Contextual Grounding</h3>
<p>The contextual grounding feature proved effective in identifying potential hallucinations by comparing model responses against reference information. Relevance and grounding scores provided quantitative measures to assess the accuracy of model outputs.</p>
<p>The python script run output below demonstrates how the <strong>Grounding Score</strong> helps detect hallucinations:</p>
<pre><code>============================================================
 Guardrail Assessment
============================================================

 **Model Response:**
   Sorry, I am not configured to answer such questions. Kindly ask a different question.

 **Guardrail Assessment:**
   Is Hallucination : True

 **Contextual Grounding Policy Scores:**
   - Relevance Score : 1.00 (Threshold: 0.99)
   - Grounding Score : 0.03 (Threshold: 0.99)

============================================================
</code></pre>
<p>Here, the <strong>Grounding Score</strong> of <strong>0.03</strong> is significantly lower than the configured threshold of <strong>0.99</strong>, indicating that the response lacks factual accuracy. Since the score falls below the threshold, the system flags the response as a hallucination, highlighting the need to monitor guardrail outputs to ensure AI safety.</p>
<h2>Configuring Amazon Bedrock Guardrails Metrics &amp; Logs Collection</h2>
<p>Elastic makes it easy to collect both logs and metrics from Amazon Bedrock Guardrails using the Amazon Bedrock integration. By default, Elastic provides a curated set of logs and metrics, but you can customize the configuration based on your needs. The integration supports Amazon S3 and Amazon CloudWatch Logs for log collection, along with metrics collection from your chosen AWS region at a specified interval.</p>
<p>Follow these steps to enable the collection of metrics and logs:</p>
<ol>
<li>
<p><strong>Navigate to Amazon Bedrock Settings</strong> - In the AWS Console, go to <strong>Amazon Bedrock</strong> and open the <strong>Settings</strong> section.</p>
</li>
<li>
<p><strong>Choose Logging Destination</strong> - Select whether to send logs to <strong>Amazon S3</strong> or <strong>Amazon CloudWatch Logs</strong>.</p>
</li>
<li>
<p><strong>Provide Required Details</strong></p>
<ul>
<li><strong>If using Amazon S3</strong>, logs can be collected from objects referenced in <strong>S3 notification events</strong> (read from an SQS queue) or by <strong>direct polling</strong> from an S3 bucket.</li>
<li><strong>If using CloudWatch Logs</strong>: you need to create a <strong>CloudWatch log group</strong> and note its <strong>ARN</strong>, as this will be required for configuring both <strong>Amazon Bedrock</strong> and <strong>Elastic Amazon Bedrock integration</strong>.</li>
</ul>
</li>
</ol>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-amazon-bedrock-guardrails/amazon-bedrock-settings-configuraiton.png" alt="Amazon Bedrock settings" /></p>
<ol start="4">
<li><strong>Configure Elastic's Amazon Bedrock integration</strong> - In <strong>Elastic</strong>, set up the <strong>Amazon Bedrock integration</strong>, ensuring the logging destination matches the one configured in <strong>Amazon Bedrock</strong>. Logs from your selected source and metrics from your AWS region will be collected automatically.</li>
</ol>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-amazon-bedrock-guardrails/amazon-bedrock-integrations-logs-config.png" alt="Amazon Bedrock integration logs configuration" /></p>
<ol start="5">
<li><strong>Accept Defaults or Customize Settings</strong> - Elastic provides a default configuration for logs and metrics collection. You can accept these defaults or adjust settings such as collection intervals to better fit your needs.</li>
</ol>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-amazon-bedrock-guardrails/amazon-bedrock-integrations-metrics-config.png" alt="Amazon Bedrock integration guardrails metrics configuration" /></p>
<h2>Understanding the pre-configured dashboard for Amazon Bedrock Guardrails</h2>
<p>You can access the Amazon Bedrock Guardrails dashboard using either of the following methods:</p>
<ol>
<li>
<p><strong>Navigate to the Dashboard Menu</strong>  - Select the <strong>Dashboard</strong> menu option in <strong>Elastic</strong> and search for <strong>[Amazon Bedrock] Guardrails</strong> to open the dashboard.</p>
</li>
<li>
<p><strong>Navigate to the Integrations Menu</strong>  - Open the <strong>Integrations</strong> menu in <strong>Elastic</strong>, select <strong>Amazon Bedrock</strong>, go to the <strong>Assets</strong> tab, and choose <strong>[Amazon Bedrock] Guardrails</strong> from the dashboard assets.</p>
</li>
</ol>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-amazon-bedrock-guardrails/amazon-bedrock-guardrails-overview-dashboard.png" alt="Amazon Bedrock settings" /></p>
<p>The Amazon Bedrock Guardrails dashboard in the Elastic integration provides insights into guardrail performance, tracking total invocations, API latency, text unit usage, and intervention rates. It analyzes policy-based interventions, highlighting trends, text consumption, and frequently triggered policies. The dashboard also showcases instances where guardrails modified or blocked responses and offers a detailed breakdown of invocations by policy and content source.</p>
<h3>Guardrail invocation overview</h3>
<p>This dashboard section provides a comprehensive summary of key metrics related to guardrail performance and usage:</p>
<ul>
<li><strong>Total guardrails API invocations</strong>: Displays the overall count of times guardrails were invoked.</li>
<li><strong>Average Guardrails API invocation latency</strong>: Shows the average response time for guardrail API calls, offering insights into system performance.</li>
<li><strong>Total text unit utilization</strong>: Indicates the volume of text processed during guardrail invocations. For pricing of text units refer to Amazon Bedrock pricing page.</li>
<li><strong>Invocations - with and without guardrail interventions</strong>: A pie chart representation showing the distribution of LLM invocations based on guardrail activity. It displays the count of invocations where no guardrail interventions occurred, those where guardrails intervened and detected policy violations, and those where guardrails intervened but found no violations.</li>
</ul>
<p>These metrics help users evaluate guardrail effectiveness, track intervention patterns, and optimize configurations to ensure policy enforcement while maintaining system performance.</p>
<h3>Guardrail policy types for interventions</h3>
<p>This section provides a comprehensive view of guardrail policy interventions and their impact:</p>
<ul>
<li><strong>Interventions by Policy Type</strong>: Bar charts display the number of interventions applied to user inputs and model outputs, categorized by policy type (e.g., Contextual Grounding Policy, Word Policy, Content Policy, Sensitive Information Policy, Topic Policy).</li>
<li><strong>Text Unit Utilization by Policy Type</strong>: Panels highlight the text units consumed by various policy interventions, separately for user inputs and model outputs.</li>
<li><strong>Policy Usage Trends</strong>: A word cloud visualisation reveals the most frequently applied policy types, offering insights into intervention patterns.</li>
</ul>
<p>By analyzing intervention counts, text unit usage, and policy trends, users can identify frequently triggered policies, optimize guardrail settings, and ensure LLM interactions align with compliance and safety requirements.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-amazon-bedrock-guardrails/amazon-bedrock-guardrails-overview.png" alt="Amazon Bedrock Guardrails dashboard overview and policy types sections" /></p>
<h3>Prompt and response where guardrails intervened</h3>
<p>This dashboard section displays the original LLM prompt, inputs from various sources (API calls, applications, or chat interfaces), and the corresponding guardrail response. The text panel presents the prompt alongside the model's response after applying guardrail interventions. These interventions occur when input evaluation or model responses violate configured policies, leading to blocked or masked outputs.</p>
<p>The section also includes additional details to enhance visibility into how guardrails operate. It indicates whether a violation was detected, along with the violation type (e.g., <strong>GROUNDING</strong>, <strong>RELEVANCE</strong>) and the action taken (<strong>BLOCKED</strong>, <strong>NONE</strong>). For contextual grounding, the dashboard also shows the filter threshold, which defines the minimum confidence level required for a response to be considered valid, and the <strong>confidence score</strong>, which reflects how well the response aligns with the expected criteria.</p>
<p>By analyzing violations, actions taken, and confidence scores, users can adjust guardrail thresholds to balance blocking unsafe responses and allowing valid ones, ensuring optimal accuracy and compliance. This process is particularly crucial for detecting and mitigating hallucinations—instances where models generate information not grounded in source data. Implementing contextual grounding checks enables the identification of such ungrounded or irrelevant content, enhancing the reliability of applications like retrieval-augmented generation (RAG).</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-amazon-bedrock-guardrails/guardrails-intervened-logs.png" alt="Amazon Bedrock Guardrails logs where guardrails intervened" /></p>
<h3>Guardrail invocation by guardrail policy</h3>
<p>This section offers insights into the number of Guardrails API invocations, the overall latency, the total text units categorised by various guardrail policies (identified by guardrail ARN) and the policy versions.</p>
<h3>Guardrail invocation by content source (Input &amp; Output)</h3>
<p>This section provides a detailed overview of critical metrics related to guardrail performance and usage. It includes the total number of guardrail invocations, the count of intervention invocations where policies were applied, the volume of text units consumed during these interventions for both user inputs and model outputs and the average guardrail API invocation latency.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-amazon-bedrock-guardrails/guardrails-invocationby-policy-contentsource.png" alt="Amazon Bedrock Guardrails invocation by policy and content source" /></p>
<p>These insights help users understand how guardrails operate across different policies and content sources. By analyzing invocation counts, latency, and text unit consumption, users can assess policy effectiveness, track intervention patterns, and optimize configurations. Evaluating how guardrails interact with user inputs and model outputs ensures consistent enforcement, helping refine thresholds and improve compliance strategies.</p>
<h2>Configure SLOs and Alerts</h2>
<p>To create an SLO for monitoring <strong>contextual grounding accuracy</strong>, define a custom query SLI where <strong>good events</strong> are model responses that meet contextual grounding criteria, ensuring factual accuracy and alignment with the provided reference.</p>
<p>A suitable query for tracking good events is:</p>
<pre><code>gen_ai.prompt : &quot;*qualifiers[\\\&quot;grounding_source\\\&quot;]*&quot; and 
(gen_ai.compliance.violation_detected : false or 
not gen_ai.compliance.violation_detected : *)
</code></pre>
<p>The total query considers all relevant interactions having contextual grounding check is:</p>
<pre><code>gen_ai.prompt : &quot;*qualifiers[\\\&quot;grounding_source\\\&quot;]*&quot;
</code></pre>
<p>Set an <strong>SLO target of 99.5%</strong>, ensuring that the vast majority of responses remain factually grounded. This helps detect hallucinations and misaligned outputs in real-time. By continuously monitoring contextual grounding accuracy, you can proactively address inconsistencies, retrain models, or refine RAG pipelines before inaccuracies impact end users.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-amazon-bedrock-guardrails/slo-configurations.png" alt="SLO settings for Guardails metrics" /></p>
<p>Elastic's alerting capabilities enable proactive monitoring of key performance metrics. For instance, by setting up an alert on the <strong>average aws_bedrock.guardrails.invocation_latency</strong> with a <strong>500ms</strong> threshold, you can promptly identify and address performance bottlenecks, ensuring that policy enforcement remains efficient without causing unexpected delays.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-amazon-bedrock-guardrails/alert-configurations.png" alt="Alert settings for Guardails metrics" /></p>
<h2>Conclusion</h2>
<p>The Elastic Amazon Bedrock integration makes it easy for you to collect a curated set of metrics and logs for your LLM-powered applications using Amazon Bedrock including Guardrails. It comes with an out-of-the-box dashboard which you can further customize for your specific needs.</p>
<p>If you haven’t already done so, read our previous <a href="https://www.elastic.co/observability-labs/blog/llm-observability-aws-bedrock">blog</a> on what you can do with the Amazon Bedrock integration, set up guardrails for your Bedrock models, and enable the <a href="https://www.elastic.co/guide/en/integrations/current/aws_bedrock.html">Bedrock integration</a> to start observing your Bedrock models and guardrails today!</p>]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/llm-observability-amazon-bedrock-guardrails/llm-observability-aws-bedrock-illustration.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[LLM Observability with the new Amazon Bedrock Integration in Elastic Observability]]></title>
            <link>https://www.elastic.co/observability-labs/blog/llm-observability-aws-bedrock</link>
            <guid isPermaLink="false">llm-observability-aws-bedrock</guid>
            <pubDate>Mon, 25 Nov 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[Elastic's new Amazon Bedrock integration for Observability provides comprehensive insights into Amazon Bedrock LLM performance and usage. Learn about how LLM based metric and log collection in real-time with pre-built dashboards can effectively monitor and resolve LLM invocation errors and performance challenges.]]></description>
            <content:encoded><![CDATA[<p>As organizations increasingly adopt LLMs for AI-powered applications such as content creation, Retrieval-Augmented Generation (RAG), and data analysis, SREs and developers face new challenges. Tasks like monitoring workflows, analyzing input and output, managing query latency, and controlling costs become critical. LLM observability helps address these issues by providing clear insights into how these models perform, allowing teams to quickly identify bottlenecks, optimize configurations, and improve reliability. With better observability, SREs can confidently scale LLM applications, especially on platforms like <a href="https://aws.amazon.com/bedrock/">Amazon Bedrock</a>, while minimizing downtime and keeping costs in check.</p>
<p>Elastic is expanding support for LLM Observability with Elastic Observability's new <a href="https://www.elastic.co/docs/current/integrations/aws_bedrock">Amazon Bedrock integration</a>. This new observability integration provides you with comprehensive visibility into the performance and usage of foundational models from leading AI companies and from Amazon available through Amazon Bedrock. The new Amazon Bedrock Observability integration offers an out-of-the-box experience by simplifying the collection of Amazon Bedrock metrics and logs, making it easier to gain actionable insights and effectively manage your models. The integration is simple to set up and comes with pre-built, out-of-the-box dashboards. With real-time insights, SREs can now monitor, optimize and troubleshoot LLM applications that are using Amazon Bedrock.</p>
<p>This blog will walk through the features available to SREs, such as monitoring invocations, errors, and latency information across various models, along with the usage and performance of LLM requests. Additionally, the blog will show how easy it is to set up and what insights you can gain from Elastic for LLM Observability.</p>
<h2>Prerequisites</h2>
<p>To follow along with this blog, please make sure you have:</p>
<ul>
<li>An account on <a href="http://cloud.elastic.co">Elastic Cloud</a> and a deployed stack in AWS (<a href="https://www.elastic.co/guide/en/elastic-stack/current/installing-elastic-stack.html">see instructions here</a>). Ensure you are using version 8.13 or higher.</li>
<li>An AWS account with permissions to pull the necessary data from AWS. <a href="https://docs.elastic.co/en/integrations/aws#aws-permissions">See details in our documentation</a>.</li>
</ul>
<h2>Configuring Amazon Bedrock Logs Collection</h2>
<p>To collect Amazon Bedrock logs, you can choose from the following options:</p>
<ol>
<li>Amazon Simple Storage Service (Amazon S3)  bucket</li>
<li>Amazon CloudWatch logs</li>
</ol>
<p><strong>S3 Bucket Logs Collection</strong>: When collecting logs from the Amazon S3 bucket, you can retrieve logs from Amazon S3 objects pointed to by Amazon S3 notification events, which are read from an SQS queue, or by directly polling a list of Amazon S3 objects in an Amazon S3 bucket. Refer to Elastic’s <a href="https://www.elastic.co/docs/current/integrations/aws_logs">Custom AWS Logs</a> integration for more details.</p>
<p><strong>CloudWatch Logs Collection</strong>: In this option, you will need to create a <a href="https://console.aws.amazon.com/cloudwatch/">CloudWatch log group</a>. After creating the log group, be sure to note down the ARN of the newly created log group, as you will need it for the Amazon Bedrock settings configuration and Amazon Bedrock integration configuration for logs.</p>
<p>Configure the Amazon Bedrock CloudWatch logs with the Log group ARN to start collecting CloudWatch logs.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-aws-bedrock/cloudwatch-logs-configuration.png" alt="" /></p>
<p>Please visit the <a href="https://aws.amazon.com/console/">AWS Console</a> and navigate to the &quot;Settings&quot; section under <a href="https://aws.amazon.com/bedrock/">Amazon Bedrock</a> and select your preferred method of collecting logs. Based on the value you select from the Logging Destination in the Amazon Bedrock settings, you will need to enter either the Amazon S3 location or the CloudWatch log group ARN.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-aws-bedrock/aws-bedrock-logs-configuration.png" alt="" /></p>
<h2>Configuring Amazon Bedrock Metrics Collection</h2>
<p>Configure Elastic's Amazon Bedrock integration to collect Amazon Bedrock metrics from your chosen AWS region at the specified collection interval.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-aws-bedrock/cloudwatch-metrics-configuration.png" alt="" /></p>
<h2>Maximize Visibility with Out-of-the-Box Dashboards</h2>
<p>Amazon Bedrock integration offers rich out-of-the-box visibility into the performance and usage information of models in Amazon Bedrock, including text and image models. The <strong>Amazon Bedrock Overview</strong> dashboard provides a summarized view of the invocations, errors and latency information across various models.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-aws-bedrock/aws-bedrock-dashboard-metric-summary.png" alt="" /></p>
<p>The <strong>Text / Chat metrics</strong> section in the <strong>Amazon Bedrock Overview</strong> dashboard provides insights into token usage for Text models in Amazon Bedrock. This includes use cases such as text content generation, summarization, translation, code generation, question answering, and sentiment analysis.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-aws-bedrock/aws-bedrock-dashboard-text-metrics.png" alt="" /></p>
<p>The <strong>Image metrics</strong> section in the <strong>Amazon Bedrock Overview</strong> dashboard offers valuable insights into the usage of Image models in Amazon Bedrock.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-aws-bedrock/aws-bedrock-dashboard-image-metrics.png" alt="" /></p>
<p>The <strong>Logs</strong> section of the <strong>Amazon Bedrock Overview</strong> dashboard in Elastic provides detailed insights into the usage and performance of LLM requests. It enables you to monitor key details such as model name, version, LLM prompt and response, usage tokens, request size, completion tokens, response size, and any error codes tied to specific LLM requests.</p>
<p>The detailed logs provide full visibility into raw model interactions, capturing both the inputs (prompts) and the outputs (responses) generated by the models. This transparency enables you to analyze and optimize how your LLM handles different requests, allowing for more precise fine-tuning of both the prompt structure and the resulting model responses. By closely monitoring these interactions, you can refine prompt strategies and enhance the quality and reliability of model outputs.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-aws-bedrock/aws-bedrock-dashboard-logs-details.png" alt="" /></p>
<p><strong>Amazon Bedrock Overview</strong> dashboard provides a comprehensive view of the initial and final response times. It includes a percentage comparison graph that highlights the performance differences between these response stages, enabling you to quickly identify efficiency improvements or potential bottlenecks in your LLM interactions.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-aws-bedrock/aws-bedrock-dashboard-performance.png" alt="" /></p>
<h2>Creating Alerts and SLOs to Monitor Amazon Bedrock</h2>
<p>As with any Elastic integration, Amazon Bedrock <a href="https://www.elastic.co/docs/current/integrations/aws_bedrock#collecting-bedrock-model-invocation-logs-from-s3-bucket">logs</a> and <a href="https://www.elastic.co/docs/current/integrations/aws_bedrock#metrics">metrics</a> are fully integrated into Elastic Observability, allowing you to leverage features like SLOs, alerting, custom dashboards, and detailed logs exploration.</p>
<p>To create an alert, for example to monitor LLM invocation latency in Amazon Bedrock, you can apply a Custom Threshold rule on the Amazon Bedrock datastream. Set the rule to trigger an alert when the LLM invocation latency exceeds a defined threshold. This ensures proactive monitoring of model performance, allowing you to detect and address latency issues before they impact the user experience.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-aws-bedrock/aws-bedrock-alert-invocation-latency.png" alt="" /></p>
<p>When a violation occurs, the Alert Details view linked in the notification provides detailed context, including when the issue began, its current status, and any history of similar violations. This rich information enables rapid triaging, investigation, and root cause analysis to resolve issues efficiently.</p>
<p>Similarly, to create an SLO for monitoring Amazon Bedrock invocation performance for instance, you can define a custom query SLI where good events are those Amazon Bedrock invocations that do not result in client errors or server errors and have latency less than 10 seconds. Set an appropriate SLO target, such as 99%. This will help you identify errors and latency issues in applications using LLMs, allowing you to take timely corrective actions before they affect the overall user experience.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-aws-bedrock/aws-bedrock-slo-configuration.png" alt="" /></p>
<p>The image below highlights the SLOs, SLIs, and the remaining error budget for Amazon Bedrock models. The observed violations are a result of deliberately crafted long text generation prompts, which led to extended response times. This example demonstrates how the system tracks performance against defined targets, helping you quickly identify latency issues and performance bottlenecks. By monitoring these metrics, you gain valuable insights for proactive issue triaging, allowing for timely corrective actions and improved user experience of applications using LLM.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-aws-bedrock/aws-bedrock-slo-rundata.png" alt="" /></p>
<h2>Try it out today</h2>
<p>The Amazon Bedrock playgrounds provide a console environment to experiment with running inference on different models and configurations before deciding to use them in an application. Start your own 7-day free trial by signing up via AWS Marketplace and quickly spin up a deployment in minutes on any of the Elastic Cloud regions on AWS around the world.</p>
<p>Deploy a cluster on our <a href="https://www.elastic.co/cloud/elasticsearch-service">Elasticsearch Service</a>, <a href="https://www.elastic.co/downloads/">download</a> the Elasticsearch stack, or run <a href="https://aws.amazon.com/marketplace/seller-profile?id=d8f59038-c24c-4a9d-a66d-6711d35d7305">Elastic from AWS Marketplace</a> then spin up the new technical preview of Amazon Bedrock integration, open the curated dashboards in Kibana and start monitoring your Amazon Bedrock service!</p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/llm-observability-aws-bedrock/LLM-observability-AWS-Bedrock.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[LLM Observability with Elastic’s Azure AI Foundry Integration]]></title>
            <link>https://www.elastic.co/observability-labs/blog/llm-observability-azure-ai-foundry</link>
            <guid isPermaLink="false">llm-observability-azure-ai-foundry</guid>
            <pubDate>Fri, 25 Jul 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[Gain comprehensive visibility into your generative AI workloads on Azure AI Foundry. Monitor token usage, latency, and cost, while leveraging built-in content filters to ensure safe and compliant application behavior—all with out-of-the-box observability powered by Elastic.]]></description>
            <content:encoded><![CDATA[<h2>Introduction</h2>
<p>As organizations increasingly adopt LLMs for AI-powered applications such as content creation, Retrieval-Augmented Generation (RAG), and data analysis, SREs and developers face new challenges. Tasks like monitoring workflows, analyzing input and output, managing query latency, and controlling costs become critical. LLM Observability helps address these issues by providing clear insights into how these models perform, allowing teams to quickly identify bottlenecks, optimize configurations, and improve reliability. With better observability, SREs can confidently scale LLM applications, especially on platforms like Azure AI Foundry, while minimizing downtime and keeping costs in check.</p>
<p>Elastic is expanding support for LLM Observability with Elastic Observability's new Azure AI Foundry integration. This is now available as a tech preview on Elastic Cloud. This new observability integration provides you with comprehensive visibility into the performance and usage of foundational models, such as <strong>GPT-4, Mistral, Llama</strong>, and thousands of others from leading AI companies and from Azure available through Azure AI Foundry. The new Azure AI Foundry Integration in Elastic Observability integration offers an out-of-the-box experience by simplifying the collection of metrics and logs, making it easier to gain actionable insights and effectively manage your models. The integration is simple to set up and comes with pre-built, out-of-the-box dashboards. With real-time insights, SREs can now monitor, optimize and troubleshoot LLM applications that are using Azure AI Foundry.</p>
<p>This blog will walk through the features available to SREs, such as monitoring invocations, errors, and latency information across various models, along with the usage and performance of LLM requests. Additionally, the blog will show how easy it is to set up and what insights you can gain from Elastic for LLM Observability.</p>
<h2>Prerequisites</h2>
<p>To get started with the Azure AI Foundry integration, you will need:</p>
<ul>
<li>An account on Elastic Cloud and a deployed stack in Azure (<a href="https://azuremarketplace.microsoft.com/en-us/marketplace/apps/elastic.ec-azure-pp?ocid=Elastic-Microsoft-Partner-Page-Get-Started">see instructions here</a>). Ensure you are using version 9.0.0 or higher.</li>
<li>An Azure account with permissions to pull the necessary data from Azure and Azure AI Foundry. See details in our <a href="https://www.elastic.co/docs/reference/integrations/azure_ai_foundry">documentation</a>.</li>
</ul>
<h2>Configuring Azure AI Foundry Integration</h2>
<p>To collect logs and metrics from Azure AI Foundry ensure you properly configure Azure logs and metrics from the following links:</p>
<ul>
<li>
<p><a href="https://www.elastic.co/docs/reference/integrations/azure_metrics#setup">Configure to receive Azure Metrics</a> - This integration specifically collects Azure AI Foundry metrics which will come from the service, and ensure you have the client id, subscription id, and tenant id from Azure AI Foundry to collect metrics.
<img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-ai-foundry/azure_ai_foundry_metrics.png" alt="Azure AI Foundry metrics" /></p>
</li>
<li>
<p><a href="https://www.elastic.co/docs/reference/integrations/azure">Configure to receive Azure Logs</a> and more specifically ensure that you <a href="https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-create">configure Azure event hub</a> to properly allow Elastic to ingest logs. Once you have the Azure event hub information, you will need it to configure the logs section of the Azure AI Foundry Integration.
<img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-ai-foundry/azure_ai_foundry_logs.png" alt="Azure AI Foundry logs" /></p>
</li>
</ul>
<h2>Maximize Visibility with Out-of-the-box dashboards</h2>
<p>Azure AI Foundry integration offers rich out-of-the-box visibility into the performance and usage information of models in Azure AI Foundry, including text and image models. There are several dashboards currently available. More will be coming as the integration goes to GA.</p>
<ul>
<li>Azure AI Foundry Overview dashboard provides a summarized view of the invocations, errors and latency information across various models.</li>
<li>Azure AI Foundry Billing dashboard - which provides total costs and daily usage costs from Azure cognitive services.</li>
<li>Azure AI Foundry Advanced Monitoring - which focuses on logs generated by the Azure AI Foundry service when connected through the API Management Service. Provides request rate, error rate, model usage, latency, LLM prompt input, response completion.</li>
</ul>
<p>Each dashboard provides specific insights important to SREs. Here is a quick overview of some of these insights:</p>
<ul>
<li>
<p><strong>Model Usage and Token Trends</strong> – Visualize token consumption and completion counts by model, endpoint, and time window.
<img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-ai-foundry/azure_ai_foundry_tokens.png" alt="Azure AI Foundry token usage metrics" /></p>
</li>
<li>
<p><strong>Latency Metrics</strong> – Monitor average and percentile latency per prompt, per endpoint, and correlate with prompt types or user IDs.
<img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-ai-foundry/azure_ai_foundry_model_latency.png" alt="Azure AI Foundry latency metrics" /></p>
</li>
<li>
<p><strong>Cost Estimation</strong> – Estimate API usage cost based on token consumption and model pricing.
<img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-ai-foundry/azure_ai_foundry_billing.png" alt="Azure AI Foundry cost estimation metrics" /></p>
</li>
<li>
<p><strong>Prompt/Completion Logging</strong> – View prompt-response pairs for debugging and quality monitoring.
<img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-ai-foundry/azure_ai_foundry_prompt_response.png" alt="Azure AI Foundry prompt/completions metrics" /></p>
</li>
<li>
<p><strong>Content Filtering and Guardrails</strong> – See which prompts or completions are being filtered, and why.
<img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-ai-foundry/azure_ai_foundry_guardrails.png" alt="Azure AI Foundry guardrails metrics" />
<img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-ai-foundry/azure_ai_foundry_prompt_filtered.png" alt="Azure AI Foundry guardrails prompt filtered" /></p>
</li>
</ul>
<p>You can drill into specific users or sessions, slice by model type or region, and export reports for usage reviews or compliance.</p>
<hr />
<h2>Try it out today</h2>
<p>The Azure AI Foundry Integration is currently available in Elastic Cloud (both serverless and hosted options). Sign up for a 7 day trial by signing up to Elastic Cloud directly or through Azure Marketplace.
Alternatively you can also deploy a cluster on our Elasticsearch Service, download the Elasticsearch stack, or run Elastic from Azure Marketplace then spin up the new technical preview of Azure AI Foundry integration, open the curated dashboards in Kibana and start monitoring your Azure AI Foundry service!</p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-ai-foundry/LLM-observability.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[Optimizing Spend and Content Moderation on Azure OpenAI with Elastic]]></title>
            <link>https://www.elastic.co/observability-labs/blog/llm-observability-azure-openai-content-filter</link>
            <guid isPermaLink="false">llm-observability-azure-openai-content-filter</guid>
            <pubDate>Tue, 13 May 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[We have added further capabilities to the Azure OpenAI GA package, which now offer content filter monitoring and enhancements to the billing insights!]]></description>
            <content:encoded><![CDATA[<p>In a previous blog we showed you how to set up observability for your models hosted on Azure OpenAI using Elastic’s integration. We’ve expanded the integration to also include Azure OpenAI content filtering, and cost analysis for Azure OpenAI. If you previously onboarded the Azure OpenAI integration, just upgrade it and you will automatically get all new features we discuss in this blog. The enhanced integration now provides multiple dashboards including a general Azure OpenAI Overview, Azure Provisioned Throughput Unit dashboard, Azure Content filtering, and a dashboard for Azure OpenAI billing.</p>
<p>In this blog we will cover how to use Azure OpenAI Content Filtering and tracking Azure OpenAI usage costs. Let’s first review what these two capabilities from Azure OpenAI enable you to do:</p>
<h2>Azure OpenAI Content Filtering: Enhancing AI Safety</h2>
<p>Content filtering for Azure OpenAI plays a critical role in addressing AI safety challenges by helping to mitigate the risks associated with harmful or inappropriate content generated by AI models. By implementing robust content filtering mechanisms, organizations can proactively identify and filter out potentially harmful content, such as hate speech, misinformation, or violent imagery, before it is disseminated to users. This helps prevent the spread of harmful content and reduces the potential negative impact on individuals and communities.</p>
<p>Monitoring Azure OpenAI content filtering is essential for staying proactive in addressing emerging content moderation challenges. By closely monitoring the system, businesses can quickly detect any new types of harmful content or patterns of misuse that may arise. This enables organizations to stay ahead of potential content moderation issues and take timely action to protect their users and uphold their brand reputation.</p>
<h2>Tracking Azure OpenAI Usage Costs</h2>
<p>Monitoring Azure OpenAI model usage costs is crucial for managing budget and resource allocation effectively. By keeping track of usage costs, organizations can optimize their operations to avoid unnecessary expenses and ensure that they are getting the best value from their investment in AI technologies. Additionally, it helps in forecasting future expenses and aids in scaling resources according to the demand without compromising performance or incurring excessive costs. Effective monitoring also allows for transparency and accountability, enabling better decision-making in terms of AI deployment and utilization within Azure environments.</p>
<p>As we walk through this blog, we will provide you with prerequisites to set up and use the pre-configured dashboards for both of these capabilities, which are part of the Azure OpenAI integration.</p>
<h2>Prerequisites</h2>
<p>In order to follow along in this blog you will have to</p>
<ol>
<li>
<p>Set up and install the Azure billing integration to monitor the usage costs. Once the integration is installed, you can track the usage in the enhanced Azure OpenAI Billing dashboard.</p>
</li>
<li>
<p>Additionally, make sure you have enabled the Azure API Management service to access the Azure OpenAI models.</p>
</li>
</ol>
<h3>How to Use Azure API Management with Azure OpenAI:</h3>
<ul>
<li><strong>Provision an Azure OpenAI resource:</strong> Create an Azure OpenAI resource and select a model for your application.</li>
<li><strong>Create an API Management instance:</strong> Establish an Azure API Management instance to manage the Azure OpenAI APIs.</li>
<li><strong>Import the Azure OpenAI API:</strong> Import the Azure OpenAI API into your API Management instance using its OpenAPI specification.</li>
<li><strong>Configure Policies:</strong> Implement policies in API Management to manage request authentication, rate limiting, traffic shaping, and more.</li>
</ul>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-openai-content-filter/llm-observability-azure_openai_create_APM.png" alt="LLM Observability: Azure OpenAI Create API Management Service" /></p>
<h2>Steps to create a content filter for Azure OpenAI</h2>
<p>Before you set up observability for the content filtering, ensure that you have configured the Azure content filtering for your model. Follow the steps below to create an Azure OpenAI content filtering,</p>
<ol>
<li><strong>Access the Azure OpenAI service console:</strong>
<ul>
<li>Sign in to the Azure Console with the appropriate permissions and navigate to the Azure OpenAI service console.</li>
</ul>
</li>
<li><strong>Navigate to Safety + security:</strong>
<ul>
<li>From the left-hand menu, select <strong>Safety + security</strong>.</li>
</ul>
</li>
<li><strong>Create a New Content filter:</strong>
<ul>
<li>Select <strong>Create content filter</strong>.</li>
<li>Configure various content filter policies including the following
<ul>
<li><strong>Set input filter:</strong> Content will be annotated by category and blocked according to the threshold you set for prompts.</li>
<li><strong>Set output filter:</strong> Content will be annotated by category and blocked according to the threshold you set for response output.</li>
<li><strong>Blocklists:</strong> Define specific words or phrases to block.</li>
<li><strong>Deployments:</strong> Apply filters to model deployments.</li>
</ul>
</li>
</ul>
</li>
<li><strong>Review and Create:</strong>
<ul>
<li>Review your settings and select Create to finalize the content filter configurations.</li>
</ul>
</li>
</ol>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-openai-content-filter/llm-observability-azure_openai_create_content_filter.png" alt="LLM Observability: Azure OpenAI Create Content Filter" /></p>
<p>Customers can also configure content filters and create custom safety policies that are tailored to their use case requirements. The configurability feature allows customers to adjust the settings, separately for prompts and completions, to filter content for each content category at different severity levels.</p>
<h2>Content filter types</h2>
<ul>
<li>The content filtering categories,
<ul>
<li>(hate, sexual, violence, self-harm)</li>
<li>Other optional classification models aimed at detecting jailbreak risk and known content for text and code.</li>
</ul>
</li>
<li>Severity level within each content filter category,
<ul>
<li>(low, medium, high)</li>
<li>Content detected at the 'safe' severity level is labeled in annotations but isn't subject to filtering and isn't configurable.</li>
</ul>
</li>
</ul>
<h2>Understanding the pre-configured dashboard for Azure OpenAI Content Filtering</h2>
<p>Now that you have set up the filter, you can see what is being filtered in Elastic through the Azure OpenAI content filtering dashboard.</p>
<ol>
<li>Navigate to the Dashboard Menu – Select the <strong>Dashboard</strong> menu option in Elastic and search for <strong>[Azure OpenAI] Content Filtering Overview</strong> to open the dashboard.</li>
<li>Navigate to the Integrations Menu – Open the <strong>Integrations</strong> menu in Elastic, select <strong>Azure OpenAI</strong>, go to the <strong>Assets</strong> tab, and choose <strong>[Azure OpenAI] Content Filtering Overview</strong> from the dashboard assets.</li>
</ol>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-openai-content-filter/llm-observability-azure_openai_content_filter_overview.png" alt="LLM Observability: Azure OpenAI Content Filtering Overview" /></p>
<p>The Azure OpenAI Content Filtering Overview dashboard in the Elastic integration provides insights into blocked requests, API latency, error rates. This dashboard also provides detailed breakdown of content being filtered by the content filtering policy.</p>
<h2>Content Filter overview</h2>
<p>When the content filtering system detects harmful content, you receive either an error on the API call if the prompt was deemed inappropriate, or the finish_reason on the response will be content_filter to signify that some of the completion was filtered.</p>
<p>This can be summarized as,</p>
<ul>
<li>
<p><strong>Prompt filters:</strong> The prompt content that is classified in the filtered category will return HTTP 400 error.</p>
</li>
<li>
<p><strong>Non-streaming completion:</strong> When the content is filtered, non-streaming completions calls won't return any content. In rare cases with longer responses, a partial result can be returned. In these cases, the finish_reason is updated.</p>
</li>
<li>
<p><strong>Streaming completion:</strong> For streaming completions calls, segments are returned back to the user as they're completed. The service continues streaming until either reaching a stop token, length, or when content that is classified at a filtered category and severity level is detected.</p>
</li>
</ul>
<h2>Prompt and response where content has been blocked</h2>
<p>This dashboard section displays the original LLM prompt, inputs from various sources (API calls, applications, or chat interfaces), and the corresponding completion response. The panel below gives a view on the responses after applying content filtering policy for prompts and completions.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-openai-content-filter/llm-observability-azure_openai_content_filter_logs.png" alt="LLM Observability: Azure OpenAI Content Filtered Logs" /></p>
<p>You can use the following code snippet  to start integrating your current prompt and settings into your application to test the content filter:</p>
<pre><code>chat_prompt = [
   {
       &quot;role&quot;: &quot;user&quot;,
       &quot;content&quot;: &quot;How to kill a mocking bird?&quot;
   }
]
</code></pre>
<p>After running the code, you can find the content being filtered by violence category with the severity level medium.
<img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-openai-content-filter/llm-observability-azure_openai_content-filter_response.png" alt="LLM Observability: Azure OpenAI Content Filtered Response" /></p>
<h2>Content filtered by content source (Input &amp; Output)</h2>
<p>The content filtering system helps monitor and moderate different categories of content based on severity levels. The categories typically include things like adult content, offensive language, hate speech, violence, and more. The severity levels indicate the degree of sensitivity or potential harm associated with the content. This panel helps the user to effectively monitor and filter out inappropriate or harmful content to maintain a safe environment.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-openai-content-filter/llm-observability-azure_openai_content_filter_category_serverity.png" alt="LLM Observability: Azure OpenAI Content Filter Category &amp; Severity Level" /></p>
<p>These metrics can be categorized into the following groups:</p>
<ul>
<li><strong>Blocked requests by category:</strong> Provides insights into the total blocked requests by category.</li>
<li><strong>Severity distribution by categories:</strong> Monitors the blocked requests by categories and severity distribution. The severity distribution may be either low, medium or high.</li>
<li><strong>Content filtered categories:</strong> Provides insights into the content filtered categories over time.</li>
</ul>
<h2>Reviewing the Azure OpenAI Billing dashboard</h2>
<p>You can now look at what you are spending on Azure OpenAI.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-openai-content-filter/llm-observability-azure_openai_billing.png" alt="LLM Observability: Azure OpenAI Billing" /></p>
<p>Here is what you see on this dashboard:</p>
<ul>
<li><strong>Total costs:</strong> This measures the total usage cost across all the model deployments.</li>
<li><strong>Overall Usage by model:</strong> This tracks the total usage costs broken down by model.</li>
<li><strong>Daily usage:</strong> Monitors usage costs on a daily basis.</li>
<li><strong>Daily usage costs by model:</strong> Monitors daily usage costs broken down by model deployments.</li>
</ul>
<h2>Conclusion</h2>
<p>The Azure OpenAI integration makes it easy for you to collect a curated set of metrics and logs for your LLM-powered applications using Azure OpenAI along with content filtered responses. It comes with an out-of-the-box dashboard which you can further customize for your specific needs.</p>
<p>Deploy a cluster on our Elasticsearch Service or download the stack, spin up the new Azure OpenAI integration, open the curated dashboards in Kibana and start monitoring your Azure OpenAI service!</p>]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-openai-content-filter/LLM-observability.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[LLM Observability with Elastic: Azure OpenAI Part 2]]></title>
            <link>https://www.elastic.co/observability-labs/blog/llm-observability-azure-openai-v2</link>
            <guid isPermaLink="false">llm-observability-azure-openai-v2</guid>
            <pubDate>Fri, 23 Aug 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[We have added further capabilities to the Azure OpenAI GA package, which now offer prompt and response monitoring, PTU deployment performance tracking, and billing insights!]]></description>
            <content:encoded><![CDATA[<p>We recently announced GA of the Azure OpenAI integration. You can find details in our previous blog <a href="https://www.elastic.co/observability-labs/blog/llm-observability-azure-openai">LLM Observability: Azure OpenAI</a>.</p>
<p>Since then, we have added further capabilities to the Azure OpenAI GA package, which now offer prompt and response monitoring, PTU deployment performance tracking, and billing insights. Read on to learn more!</p>
<h2>Advanced Logging and Monitoring</h2>
<p>The initial GA release of the integration focused mainly on the native logs, to track the telemetry of the service by using <strong>cognitive services logging</strong>. This version of the Azure OpenAI integration allows you to process the advanced logs which gives a more holistic view of OpenAI resource usage.</p>
<p>To achieve this, you have to setup API Management services in Azure. The API Management service is a centralized place where you can put all OpenAI services endpoints to manage all of them end-to-end. Enable the API Management services and configure the Azure event hub to stream the logs.</p>
<p>To learn more about setting up the API Management service to access Azure OpenAI, please refer to the <a href="https://learn.microsoft.com/en-us/azure/architecture/ai-ml/openai/architecture/log-monitor-azure-openai">Azure documentation</a>.</p>
<p>By using advanced logging, you can collect the following log data:</p>
<ul>
<li>Request input text</li>
<li>Response output text</li>
<li>Content filter results</li>
<li>Usage Information
<ul>
<li>Input prompt tokens</li>
<li>Output completion tokens</li>
<li>Total tokens</li>
</ul>
</li>
</ul>
<p>Azure OpenAI integration now collects the API Management Gateway logs. When a question from the user goes to the API Management, it logs the questions and the responses from the GPT models.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-openai-v2/llm-observability-azure-openai-log-categories.png" alt="LLM Observability: Azure OpenAI Logs Overview" /></p>
<p>Here’s what a sample log looks like,
<img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-openai-v2/llm-observability-advance-log-monitoring.png" alt="LLM Observability: Azure OpenAI Advanced Logs" /></p>
<h3>Content filtered results</h3>
<p>Azure OpenAI’s content filtering system detects and takes action on specific categories of potentially harmful content in both input prompts and output completions. With Azure OpenAI model deployments, you can use the default content filter or create your own content filter.</p>
<p>Now, The integration collects the content filtered result logs. In this example let's create a custom filter in the Azure OpenAI Studio that generates an error log.</p>
<p>By leveraging the <strong>Azure Content Filters</strong>, you can create your own custom lists of terms or phrases to block or flag.
<img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-openai-v2/llm-observability-azure-content-filters.png" alt="LLM Observability: Azure OpenAI Set Content Filter" /></p>
<p>And the document ingested in Elastic would look like this:
<img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-openai-v2/llm-observability-content-filter-logs.png" alt="LLM Observability: Azure OpenAI Content Filter Logs" />
This screenshot provides insights into the content filtered request.</p>
<h2>PTU Deployment Monitoring</h2>
<p><a href="https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/provisioned-throughput">Provisioned throughput units (PTU)</a> are units of model processing capacity that you can reserve and deploy for processing prompts and generating completions.</p>
<p>The curated dashboard for PTU Deployment gives comprehensive visibility into metrics such as request latency, active token usage, PTU utilization, and fine-tuning activities, offering a quick snapshot of your deployment's health and performance.</p>
<p>Here are the essential PTU metrics captured by default:</p>
<ul>
<li><strong>Time to Response:</strong> Time taken for the first response to appear after a user send a prompt.</li>
<li><strong>Active Tokens:</strong> Use this metric to understand your TPS or TPM based utilization for PTUs and compare to the benchmarks for target TPS or TPM scenarios.</li>
<li><strong>Provision-managed Utilization V2:</strong> Provides insights into utilization percentages, helping prevent overuse and ensuring efficient resource allocation.</li>
<li><strong>Prompt Token Cache Match Rate:</strong> The prompt token cache hit ratio expressed as a percentage.</li>
</ul>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-openai-v2/llm-observability-azure_open_ai_ptu_deployment.png" alt="LLM Observability: Azure OpenAI PTU Deployment Metrics Monitoring" /></p>
<h2>Using Billing for cost</h2>
<p>Using the curated overview dashboard you can now monitor the actual usage cost for the AI applications. You are one step away from processing the billing information.</p>
<p>You need to configure and install the <a href="https://www.elastic.co/docs/current/integrations/azure_billing">Azure billing metrics integration</a>. Once the installation is complete the usage cost is visualized for the cognitive services in the Azure OpenAI overview dashboard.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-openai-v2/llm-observability-azure_openai_billing_overview.png" alt="LLM Observability: Azure OpenAI Usage Cost Monitoring" /></p>
<h2>Try it out today</h2>
<p>Deploy a cluster on our <a href="https://www.elastic.co/cloud/elasticsearch-service">Elasticsearch Service</a> or <a href="https://www.elastic.co/downloads/">download</a> the stack, spin up the new Azure OpenAI integration, open the curated dashboards in Kibana and start monitoring your Azure OpenAI service!</p>]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-openai-v2/LLM-observability.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[LLM Observability: Azure OpenAI]]></title>
            <link>https://www.elastic.co/observability-labs/blog/llm-observability-azure-openai</link>
            <guid isPermaLink="false">llm-observability-azure-openai</guid>
            <pubDate>Mon, 24 Jun 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[We are excited to announce the general availability of the Azure OpenAI Integration that provides comprehensive Observability into the performance and usage of the Azure OpenAI Service!]]></description>
            <content:encoded><![CDATA[<p>We are excited to announce the general availability of the <a href="https://www.elastic.co/integrations/data-integrations?solution=all-solutions&amp;category=azure">Azure OpenAI Integration</a> that provides comprehensive Observability into the performance and usage of the <a href="https://azure.microsoft.com/en-us/products/ai-services/openai-service">Azure OpenAI Service</a>! Also look at <a href="https://www.elastic.co/observability-labs/blog/llm-observability-azure-openai-v2">Part 2 of this blog</a></p>
<p>While we have offered <a href="https://www.elastic.co/observability-labs/blog/monitor-openai-api-gpt-models-opentelemetry">visibility into LLM environments</a> for a while now, the addition of our Azure OpenAI integration enables richer out-of-the-box visibility into the performance and usage of your Azure OpenAI based applications, further enhancing LLM Observability.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-openai/llm-observability-azure-openai-monitoring.png" alt="LLM Observability: Azure OpenAI Monitoring" /></p>
<p>The Azure OpenAI integration leverages <a href="https://www.elastic.co/elastic-agent">Elastic Agent</a>’s Azure integration capabilities to collect both logs (using <a href="https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/stream-monitoring-data-event-hubs">Azure EventHub</a>) and metrics (using <a href="https://learn.microsoft.com/en-us/azure/azure-monitor/reference/supported-metrics/metrics-index">Azure Monitor</a>) to provide deep visibility on the usage of the <a href="https://azure.microsoft.com/en-us/products/ai-services/openai-service">Azure OpenAI Service</a>.</p>
<p>The integration includes an out-of-the-box dashboard that summarizes the most relevant aspects of the service usage, including request and error rates, token usage and chat completion latency.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-openai/llm-observability-azure-openai-monitoring-overview.png" alt="LLM Observability: Azure OpenAI Monitoring Overview" /></p>
<h2>Creating Alerts and SLOs to monitor Azure OpenAI</h2>
<p>As with every other Elastic integration, all the <a href="https://www.elastic.co/docs/current/integrations/azure_openai#logs">logs</a> and <a href="https://www.elastic.co/docs/current/integrations/azure_openai#metrics">metrics</a> information is fully available to leverage in every capability in <a href="https://www.elastic.co/observability">Elastic Observability</a>, including <a href="https://www.elastic.co/guide/en/observability/current/slo.html">SLOs</a>, <a href="https://www.elastic.co/guide/en/observability/current/create-alerts.html">alerting</a>, custom <a href="https://www.elastic.co/guide/en/kibana/current/dashboard.html">dashboards</a>, in-depth <a href="https://www.elastic.co/guide/en/observability/current/monitor-logs.html">logs exploration</a>, etc.</p>
<p>To create an alert to monitor token usage, for example, start with the Custom Threshold rule on the Azure OpenAI datastream and set an aggregation condition to track and report violations of token usage past a certain threshold.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-openai/llm-observability-azure-openai-create-alert.png" alt="LLM Observability: Azure OpenAI Monitoring Alert Creation" /></p>
<p>When a violation occurs, the Alert Details view linked in the alert notification for that alert provides rich context surrounding the violation, such as when the violation started, its current status, and any previous history of such violations, enabling quick triaging, investigation and root cause analysis.</p>
<p>Similarly, to create an SLO to monitor error rates in Azure OpenAI calls, start with the custom query SLI definition adding in the good events to be any result signature at or above 400 over a total value that includes all responses. Then, by setting an appropriate SLO target such as 99%, start monitoring your Azure OpenAI error rate SLO over a period of 7, 30, or 90 days to track degradation and take action before it becomes a pervasive problem.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-openai/llm-observability-azure-openai-create-slo.png" alt="LLM Observability: Azure OpenAI Monitoring SLO Creation" /></p>
<p>Please refer to the <a href="https://www.elastic.co/guide/en/observability/current/monitor-azure-openai.html">User Guide</a> to learn more and to get started!</p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/llm-observability-azure-openai/AI_fingertip_touching_human_fingertip.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[End to end LLM observability with Elastic: seeing into the opaque world of generative AI applications]]></title>
            <link>https://www.elastic.co/observability-labs/blog/llm-observability-elastic</link>
            <guid isPermaLink="false">llm-observability-elastic</guid>
            <pubDate>Wed, 02 Apr 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[Elastic’s LLM Observability delivers end-to-end visibility into the performance, reliability, cost, and compliance of LLMs across Amazon Bedrock, Azure OpenAI, Google Vertex AI, and OpenAI, empowering SREs to optimize and troubleshoot AI-powered applications.]]></description>
            <content:encoded><![CDATA[<p>In the ever-evolving landscape of artificial intelligence, Large Language Models (LLMs) stand as beacons of innovation, offering unprecedented capabilities across industries. From generating human-like text and translating languages to providing personalized customer interactions, the possibilities with LLMs are vast and increasingly indispensable. Enterprises are deploying these models for everything, from automating customer support systems to enhancing creative writing processes. Imagine a virtual assistant not only answering questions but also drafting business proposals or a customer service bot that understands and responds with empathy—all powered by LLMs. However, with great power comes the need for great oversight.</p>
<p>Despite the transformative potential, LLMs introduce complex challenges that necessitate a new level of observability as LLMs are notoriously opaque. Enter LLM observability: a crucial component in the lifecycle management of LLMs. This aspect becomes vital for Service Reliability Engineers (SREs) and other key stakeholders tasked with ensuring seamless, error-free operations, cost control, and minimizing the risks associated with the unpredictable nature of LLM generated responses. SREs need insights into performance metrics, error frequencies, latency issues, the cost implications of running these sophisticated models, and the prompt and response exchange with the model. Traditional monitoring tools fall short in this high-stakes environment; what’s needed is a nuanced approach to address the unique observability demands that LLMs introduce.</p>
<h3>Elastic's LLM Observability Capabilities Address These Challenges</h3>
<p>With Elastic’s end-to-end LLM observability you can cover a wide range of use cases. To achieve this, you can onboard two types of integrations - API-based logs and metrics and via APM instrumentation. Depending on your use case, you can also choose to use of the LLM integrations.</p>
<ol>
<li>
<p><strong>High level overview</strong>: via API-based logs and metrics. Monitoring LLM services from providers by ingesting a curated set of service metrics and logs like latency, invocation frequency, tokens, errors, and prompts and responses. Each LLM integration comes with out-of-the-box dashboards.</p>
</li>
<li>
<p><strong>Troubleshooting applications</strong>: via APM instrumentation. Fully OTel-native tracing and auto-instrumentation for LLM-based applications through Elastic Distributions of OpenTelemetry (EDOT). Additionally, you can use third party libraries (Langtrace, OpenLit, OpenLLMetry) together with Elastic to extend the coverage to additional LLM-related technologies. </p>
</li>
</ol>
<h4>High level overview: LLM Observability for Leading Providers</h4>
<p>Elastic offers tailored API-based integrations for four major LLM hosting providers:</p>
<ul>
<li>
<p>Azure OpenAI</p>
</li>
<li>
<p>OpenAI</p>
</li>
<li>
<p>Amazon Bedrock</p>
</li>
<li>
<p>Google Vertex AI</p>
</li>
</ul>
<p>These integrations bring a curated set of logs and metrics collection tailored to each provider. What this means for SREs is straightforward access to pre-configured dashboards that highlight the prompts and responses, usage patterns, performance metrics, and cost details across different models and providers.</p>
<p>For instance, SREs keen on identifying which LLM generates the most errors or insights about the models in terms of latency, cost, or usage frequency can leverage these integrations. Imagine having the capability to instantly visualize which LLM is slowing down processes or incurring high costs, thus enabling data-driven decisions to optimize operations.</p>
<h4>Troubleshooting applications: Tracing and Auto-Instrumentation of OpenAI, Amazon Bedrock and Google Vertex AI models</h4>
<p>Elastic supports OTLP tracing capabilities in EDOT for applications using OpenAI models and models hosted on Amazon Bedrock and Google Vertex AI. In addition, Elastic also supports LLM tracing from third party libraries (Langtrace, OpenLIT, OpenLLMetry). </p>
<p>Tracing offers a comprehensive map of an application's request flow, pinpointing granular details about each call within the system. For each transaction and span of a request, tracing shows critical information such as specific models utilized, request duration, errors encountered, tokens used per request, and the prompts and responses between the LLM.</p>
<p>Tracing helps SREs troubleshoot performance issues with applications developed in languages like Python, Node.js and Java.&quot; If an SRE needs to investigate latency or error issues, LLM tracing provides a zoomed-in view into the request lifecycle and allows for profound insights into whether a delay is application-specific, model-specific or systemic across deployments.</p>
<h3>Use Cases: Bringing Elastic's Observability Features to Life</h3>
<p>Let’s explore some practical scenarios where Elastic’s observability tools shine:</p>
<h4>1. Understanding LLM Performance and Reliability</h4>
<p>An SRE team looking to optimize a customer support system powered by Azure OpenAI can utilize Elastic’s <a href="https://www.elastic.co/guide/en/integrations/current/azure_openai.html">Azure OpenAI integration</a> to quickly ascertain which model variants incur higher latency or error rates. This enhances decision-making regarding model deployment or even switching providers based on performance metrics.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-elastic/Azure-OpenAI.png" alt="Azure OpenAI" /></p>
<p>Similarly SREs can also use in parallel integrations for <a href="https://www.elastic.co/guide/en/integrations/current/gcp_vertexai.html">Google Vertex AI</a>, <a href="https://www.elastic.co/guide/en/integrations/current/aws_bedrock.html">Amazon Bedrock</a>, and <a href="https://www.elastic.co/guide/en/integrations/current/openai.html">OpenAI</a> for other applications using models hosted on these providers.</p>
<h4>2. Troubleshooting OpenAI-Powered Applications</h4>
<p>Consider an enterprise utilizing an OpenAI model for real-time user interactions. Encountering unexplained delays, an SRE can use OpenAI tracing to dissect the transaction pathway, identifying if one specific API call or model invocation is the bottleneck. The SRE can also check the out-of-the-box OpenAI integration dashboard to verify if the latency is only affecting this application or all model invocations across the organization.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-elastic/OpenAI-tracing.png" alt="OpenAI Tracing" /></p>
<p>An engineer troubleshooting the LLM-based application can also check to see what were the prompt and response exchanges with the LLM during this request so they can rule out possible impact on performance due to the input.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-elastic/OpenAI-trace.png" alt="OpenAI Trace sample with logs " /></p>
<h4>3. Addressing Cost and Usage Concerns</h4>
<p>SREs are generally acutely aware of which LLM configurations are less cost-effective than required. Elastic’s integration dashboards, pre-configured to display model usage patterns, help mitigate unnecessary spending effectively. You can find out-of-the box dashboards for Azure OpenAI, OpenAI, Amazon Bedrock, and Google VertexAI models. These dashboards show key cost and usage information such as total invocations and tokens, as well as time series breakdown by model and endpoint. In addition, some integrations show more advanced usage information such as provisioned throughput units (PTU) as well as billing cost.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-elastic/GCP-Vertex-AI.png" alt="GCP Vertex AI" /></p>
<h4>4. Understanding LLM Compliance </h4>
<p>With the Elastic Amazon Bedrock integration for Guardrails, and Azure OpenAI integration for content filtering, SREs can swiftly address security concerns, like verifying if certain user interactions prompt policy violations. Elastic's observability logs clarify whether guardrails rightly blocked potentially harmful responses, bolstering compliance assurance.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-elastic/Bedrock-Guardrails.png" alt="Bedrock-Guardrails.png" /></p>
<h3>Conclusion</h3>
<p>As LLMs continue to revolutionize the capabilities of modern applications, the role of observability becomes increasingly paramount. Elastic’s comprehensive observability framework empowers enterprises to harness the full potential of LLMs while maintaining robust operational insight and control. The integration with prominent LLM hosting providers and advanced tracing for OpenAI, Amazon Bedrock and Google Vertex AI models, equips SREs with the necessary arsenal to navigate the complex landscape of LLM-driven applications, ensuring they remain safe, reliable, efficient, and cost-effective.</p>
<p>In this new era of AI, balancing innovation with observability isn't just beneficial—it's essential. Whether optimizing performance, troubleshooting intricacies, or managing costs and compliance, Elastic stands at the forefront, ensuring your LLM journey is as seamless as it is groundbreaking.</p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/llm-observability-elastic/llm-e2e.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[LLM observability: track usage and manage costs with Elastic's OpenAI integration]]></title>
            <link>https://www.elastic.co/observability-labs/blog/llm-observability-openai</link>
            <guid isPermaLink="false">llm-observability-openai</guid>
            <pubDate>Tue, 11 Mar 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[Elastic's new OpenAI integration for Observability provides comprehensive insights into OpenAI model usage. With our pre-built dashboards and metrics, you can effectively track and monitor OpenAI model usage including GPT-4o and DALL·E.]]></description>
            <content:encoded><![CDATA[<p>In an era where AI-driven applications are becoming ubiquitous, understanding and managing the usage of language models is crucial. OpenAI has been at the forefront of developing advanced language models that power a multitude of applications, from chatbots to code generation. However, as applications grow in complexity and scale, observing crucial metrics that ensure optimal performance and cost-effectiveness becomes essential. Specific needs arise in areas such as performance and reliability monitoring, and cost management, which are pivotal for maximizing the potential of language models.</p>
<p>As organizations adopt OpenAI's diverse AI models, including language models like GPT-4o and GPT-3.5 Turbo, image models like DALL·E, and audio models like Whisper, comprehensive usage monitoring is crucial to track and optimize performance, reliability, usage and cost of each model.</p>
<p>Elastic's new <a href="https://www.elastic.co/guide/en/integrations/current/openai.html">OpenAI integration</a> offers a solution to the challenges faced by developers and businesses using these models. It is designed to provide a unified view of your OpenAI usage across all model types.</p>
<h3>Key benefits of the OpenAI integration</h3>
<p>OpenAI's usage-based pricing model applies across all these services, making it essential to track consumption and identify which models are being used to control costs and optimize deployments. The new OpenAI integration by Elastic utilizes the <a href="https://platform.openai.com/docs/api-reference/usage">OpenAI Usage API</a> to track consumption and identify specific models being used. It offers an out-of-the-box experience with pre-built dashboards, simplifying the process of monitoring your usage patterns.</p>
<p>Continue reading to learn about what you will get with the integration. We'll also show you the setup process, how to leverage the pre-built dashboards, and what insights you can gain from Elastic for LLM Observability.</p>
<h2>Setting up the OpenAI Integration</h2>
<h3>Prerequisites</h3>
<p>To follow along with this blog, you will need:</p>
<ul>
<li>An Elastic cloud account (version 8.16.3 or higher). Alternatively, you can use <a href="https://www.elastic.co/cloud/serverless">Elastic Cloud Serverless</a>, a fully managed solution that eliminates infrastructure management, automatically scales based on usage, and lets you focus entirely on extracting value from your data.</li>
<li>An OpenAI account with an <a href="https://platform.openai.com/docs/api-reference/admin-api-keys">Admin API key</a>.</li>
<li>Applications that use the OpenAI APIs.</li>
</ul>
<h3>Generating sample OpenAI usage data</h3>
<p>If you're new to OpenAI and eager to try this integration, you can quickly set it up and populate your dashboards with sample data. You'll just need to generate some usage by interacting with the OpenAI API. If you don't have an OpenAI API key, you can create one <a href="https://platform.openai.com/api-keys">here</a>. For more information on authentication, refer to the OpenAI <a href="https://platform.openai.com/docs/api-reference/authentication">documentation</a>.</p>
<p>The OpenAI documentation provides detailed examples for each of their API endpoints. Here are direct links to the relevant sections for generating sample usage data:</p>
<ul>
<li>Language models (completions): Use the Chat Completions API to generate text. See the examples <a href="https://platform.openai.com/docs/api-reference/chat/create">here</a>.</li>
<li>Audio models (text-to-speech): Generate audio from text using the Speech API. See the examples <a href="https://platform.openai.com/docs/api-reference/audio/createSpeech">here</a>.</li>
<li>Audio models (speech-to-text): Transcribe audio to text using the Transcriptions API. See the examples <a href="https://platform.openai.com/docs/api-reference/audio/createTranscription">here</a>.</li>
<li>Embeddings: Generate vector representations of text using the Embeddings API. See the examples <a href="https://platform.openai.com/docs/api-reference/embeddings">here</a>.</li>
<li>Image models: Create images from text prompts using the Image Generation API. See the examples <a href="https://platform.openai.com/docs/api-reference/images/create">here</a>.</li>
<li>Moderation: Check the contents with Moderation API. See the examples <a href="https://platform.openai.com/docs/api-reference/moderations">here</a>.</li>
</ul>
<p>There are more endpoints that you can explore to generate sample usage data.</p>
<p>After running these examples (using your API key), remember that the OpenAI <a href="https://platform.openai.com/docs/api-reference/usage">Usage API</a> has a delay. It may take some time (usually a few minutes) for the usage data to appear in your dashboard.</p>
<h3>Configuration</h3>
<p>To connect the OpenAI integration to your OpenAI account, you'll need your OpenAI's <a href="https://platform.openai.com/settings/organization/admin-keys">Admin API key</a>. The integration will use this key to periodically retrieve usage data from the OpenAI <a href="https://platform.openai.com/docs/api-reference/usage">Usage API</a>.</p>
<p>The integration supports eight distinct <a href="https://www.elastic.co/guide/en/integrations/current/openai.html#openai-data-streams">data streams</a>, corresponding to different categories of OpenAI API usage:</p>
<ul>
<li>Audio speeches (text-to-speech)</li>
<li>Audio transcriptions (speech-to-text)</li>
<li>Code interpreter sessions</li>
<li>Completions (language models)</li>
<li>Embeddings</li>
<li>Images</li>
<li>Moderations</li>
<li>Vector stores</li>
</ul>
<p>By default, all data streams are enabled. However, you can disable any data streams that are not relevant to your usage. All enabled data streams are visualized in a single, comprehensive dashboard, providing a unified view of your usage.</p>
<p>For advanced users, the integration offers additional configuration options, including setting the bucket width and initial interval. These options are documented in detail in the official integration <a href="https://www.elastic.co/guide/en/integrations/current/openai.html#openai-collection-behavior">documentation</a>.</p>
<h2>Maximize visibility with the out-of-the-box dashboard</h2>
<p>You can access the OpenAI dashboard in two ways:</p>
<ol>
<li>Navigate to the Dashboards menu in the left side panel and search for &quot;OpenAI&quot;. In the search results select  <strong>[Metrics OpenAI] OpenAI Usage Overview</strong> to open the dashboard.</li>
<li>Alternatively, navigate to the Integrations Menu — Open the <strong>Integrations</strong> menu under the <strong>Management</strong> section in Elastic, select <strong>OpenAI</strong>, go to the <strong>Assets</strong> tab, and choose <strong>[Metrics OpenAI] OpenAI Usage Overview</strong> from the dashboards assets.</li>
</ol>
<h3>Understanding the pre-configured dashboard for OpenAI</h3>
<p>The pre-built dashboard provides a structured view of OpenAI's API consumption, displaying key metrics such as token usage, API call distribution, and model-wise invocation counts. It highlights top-performing projects, users, and API keys, along with breakdowns of image generation, audio transcription, and text-to-speech usage. By analyzing these insights, users can track usage patterns, and optimize AI-driven applications.</p>
<h3>OpenAI usage metrics overview</h3>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-openai/dashboard-overview.png" alt="LLM Observability: OpenAI usage metrics overview" /></p>
<p>This dashboard section shows key usage metrics from OpenAI, including invocation rates, token usage, and the top-performing models. It also highlights the total number of invocations and tokens and the invocation count by object type. Understanding these insights can help users optimize model usage, reduce costs, and enhance efficiency when integrating AI models into their applications.</p>
<h3>Top performing Project, User, and API Key IDs</h3>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-openai/dashboard-top-tables.png" alt="LLM Observability: Top performing Project, User, and API Key IDs" /></p>
<p>Here, you can analyze the top Project IDs, User IDs, and API Key IDs based on invocation counts. This data provides valuable insights to help organizations track usage patterns across different projects and applications.</p>
<h3>Token metrics</h3>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-openai/dashboard-token-metrics.png" alt="LLM Observability: Token metrics" /></p>
<p>In this dashboard section you can see token usage trends across various models. This can help you analyze trends across input types (e.g., audio, embeddings, moderations), output types (e.g., audio), and input cached tokens. This information can help developers fine-tune their prompts and optimize token consumption.</p>
<h3>Image generation metrics</h3>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-openai/dashboard-image-metrics.png" alt="LLM Observability: Image generation metrics" /></p>
<p>AI-generated images are becoming increasingly popular across industries. This section provides an overview of image generation metrics, including invocation rates by model and the most <a href="https://platform.openai.com/docs/guides/images#size-and-quality-options">common output dimensions</a>. These insights help assess invocation costs and analyze image generation usage.</p>
<h3>Audio transcription metrics</h3>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-openai/dashboard-audio-transcription-metrics.png" alt="LLM Observability: Audio transcription metrics" /></p>
<p>OpenAI's AI-powered transcription services make speech-to-text conversion easier than ever. This section tracks audio transcription metrics, including invocation rates and total transcribed seconds per model. Understanding these trends can help businesses optimize costs when building audio transcription-based applications.</p>
<h3>Audio speech metrics</h3>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-openai/dashboard-audio-speech.png" alt="LLM Observability: Audio speech metrics" /></p>
<p>OpenAI's text-to-speech (TTS) models deliver realistic voice synthesis for applications such as accessibility tools and virtual assistants. This section explores TTS invocation rates and the number of characters synthesized per model, offering insights into the adoption of AI-driven voice synthesis.</p>
<h2>Creating Alerts and SLOs to monitor OpenAI</h2>
<p>As with every other Elastic integration, all the logs and metrics information is fully available to leverage in every capability in <a href="https://www.elastic.co/observability">Elastic Observability</a>, including <a href="https://www.elastic.co/guide/en/observability/current/slo.html">SLOs</a>, <a href="https://www.elastic.co/guide/en/observability/current/create-alerts.html">alerting</a>, custom <a href="https://www.elastic.co/guide/en/kibana/current/dashboard.html">dashboards</a>, in-depth <a href="https://www.elastic.co/guide/en/observability/current/monitor-logs.html">logs exploration</a>, etc.</p>
<p>To proactively manage your OpenAI token usage and avoid unexpected costs, <a href="https://www.elastic.co/guide/en/observability/current/create-alerts-rules.html">create</a> a custom threshold rule in Observability Alerts.</p>
<p><em>Example</em>: Target the relevant data stream, and configure the rule to sum the related tokens field (along with other token-related fields, if applicable). Set a threshold representing your desired usage limit, and the alert will notify you if this limit is exceeded within a specified timeframe, such as daily or hourly.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-openai/dashboard-create-alert.png" alt="LLM Observability: Alert creation" /></p>
<p>When an alert condition is met, the Alert Details view linked in the alert notification for that alert provides detailed insights surrounding the violation, such as when the violation started, its current status, and any previous history of similar violations, enabling proactive issue resolution, and improving system resilience.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-openai/dashboard-alert-overview.png" alt="LLM Observability: Alert overview" /></p>
<p><em>Example</em>: To create an SLO that monitors model distribution in OpenAI, start by defining a custom metric SLI definition, adding good events where <code>openai.base.model</code> contains <code>gpt-3.5*</code> and total events encompassing all OpenAI requests, grouped by <code>openai.base.project_id</code> and <code>openai.base.user_id</code>. Then, set an appropriate SLO target such as 80% and monitor this over a 7-day rolling window to identify projects and users that may be overusing more expensive models.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-openai/dashboard-create-slo.png" alt="LLM Observability: SLO creation" /></p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/llm-observability-openai/dashboard-slo-overview.png" alt="LLM Observability: SLO overview" /></p>
<p>You can now track the distribution of requests across different OpenAI models by project and user. This example demonstrates how Elastic's OpenAI integration helps you optimize costs. By monitoring the percentage of requests handled by cost-efficient GPT-3.5 models — the SLI — against the 80% target (part of the SLO), you can quickly identify which specific projects or users are driving up costs through excessive usage of models like GPT-4-turbo, GPT-4o, etc. This visibility enables targeted optimization strategies, ensuring your AI initiatives remain cost-effective while still leveraging advanced capabilities.</p>
<h2>Conclusion, next steps and further reading</h2>
<p>You now know how Elastic's OpenAI integration provides an essential tool for anyone relying on OpenAI's models to power their applications. By offering a comprehensive and customizable dashboard, this integration empowers SREs and developers to effectively monitor performance, manage costs, and optimize your AI systems effortlessly. Now, it's your turn to onboard this application following the instructions in this blog and start monitoring your OpenAI usage! We'd love to hear from you on how you get on and always welcome ideas for enhancements.</p>
<p>To learn how to set up Application Performance Monitoring (APM) tracing of OpenAI-powered applications, read this <a href="https://www.elastic.co/observability-labs/blog/elastic-opentelemetry-openai">blog</a>. For further reading and more LLM observability use cases, explore Elastic's observability lab blogs <a href="https://www.elastic.co/observability-labs/blog/tag/llmobs">here</a>.</p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/llm-observability-openai/llm-observability-openai.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[Automating User Journeys for Synthetic Monitoring with MCP in Elastic]]></title>
            <link>https://www.elastic.co/observability-labs/blog/mcp-elastic-synthetics</link>
            <guid isPermaLink="false">mcp-elastic-synthetics</guid>
            <pubDate>Wed, 17 Sep 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[This post explores how you can automatically create user journeys with Synthetic Monitoring in Elastic Observability, TypeScript, and FastMCP, and walks through the app and its workflow.]]></description>
            <content:encoded><![CDATA[<p><a href="https://www.elastic.co/docs/solutions/observability/synthetics">Synthetic Monitoring in Elastic Observability</a> enables you to track user pathways using a global testing infrastructure, emulating the full user path to measure the impact of web applications. It also provides comprehensive insight into your website's performance, functionality, and availability from development to production, allowing you to identify and resolve issues before they affect your customers.</p>
<p>One of the main components of Elastic's Synthetic Monitoring is the ability to create user journeys, which can be done with or without code. There is a <a href="https://github.com/elastic/synthetics">Synthetics agent,</a>, a CLI tool that guides you through the process of creating both heartbeat monitors and user journeys and deploying your code to Elastic Observability. If you are using code to create user journeys, you are using <a href="https://playwright.dev/">Playwright</a> under the hood with some additional configuration to make it easier to work with Elastic Observability.</p>
<p>To automatically create user journeys using TypeScript, you can create Playwright tests based on a prompt using <a href="https://www.warp.dev">Warp</a>, an AI-assisted terminal, <a href="https://deepmind.google/models/gemini/pro/">Gemini 2.5 Pro</a>, and <a href="https://modelcontextprotocol.io/docs/getting-started/intro">MCP</a>. This application was built using Python and <a href="https://gofastmcp.com/getting-started/welcome">FastMCP</a>, which wraps the synthetic agent to deploy browser tests to Elastic automatically. This blog post will guide you through how the application works, how to use it, and its development process. You can find the complete code on <a href="https://github.com/JessicaGarson/MCP-Elastic-Synthetics">GitHub</a>.</p>
<h2>Solution overview</h2>
<p><img src="https://www.elastic.co/observability-labs/assets/images/mcp-elastic-synthetics/01-diagram.jpg" alt="diagram" /></p>
<p>Currently, this solution is set up to run inside Warp as an <a href="https://docs.warp.dev/knowledge-and-collaboration/mcp">MCP server</a>; however, you can also use another client, such as <a href="https://claude.ai/download">Claude Desktop</a> or <a href="https://cursormcp.com/en">Cursor</a>. From there, you create a Python script using <a href="https://gofastmcp.com/getting-started/welcome">FastMCP</a>, which allows you to create functions that are callable by an LLM. Within Warp, you can make a configuration file in JSON that enables you to point to your Python script and pass in all the environment variables you are working with. From there, you'll want to toggle agent mode and ask a question about creating synthetic testing or call the MCP function directly. There are many options for which LLM you can select, be sure to check out <a href="https://docs.warp.dev/agents/using-agents">Warp's documentation</a> to learn more about the options available.</p>
<p>After that, you should ask a question about creating synthetic testing or call the MCP function you are looking for. The following three functions can be used:</p>
<ul>
<li>
<p><code>diagnose_warp_mcp_config</code>
Used for debugging environment variable issues that may arise. This function likely won't be needed unless there is an issue with your configuration.</p>
</li>
<li>
<p><code>create_and_deploy_browser_test</code>
Will automatically create Playwright tests if given the test name, the URL you want to test, and a schedule. This approach uses a template-based method, rather than a machine learning-based method, and all the tests it outputs will appear similar.</p>
</li>
<li>
<p><code>llm_create_and_deploy_test_from_prompt</code>
Similar to <code>create_and_deploy_browser_test</code>, but the main difference is that it uses an LLM to create tests based on a prompt you give it. The tests should reflect the prompt you provided. To run this function you'll provide a test name, URL, prompt, and schedule.</p>
</li>
</ul>
<h2>Why create this solution as an MCP server?</h2>
<p>The reason this was developed as an MCP server, as opposed to just a standalone script or a standard CLI, is that it can be structured and interacted with in a more conversational manner. It enables an LLM to generate dynamic Playwright testing while maintaining consistent arguments, environment variables, and responses to ensure accuracy and reliability. Thus, it becomes a reliable workflow that other agents or developers can compose with additional tools. In other words, the MCP layer turns your LLM-based test authoring into a standardized, reusable capability instead of a one-off script. To learn more about the direction of MCP, be sure to check out our article on the <a href="https://www.elastic.co/search-labs/blog/mcp-current-state">topic.</a></p>
<h2>Implementation considerations</h2>
<p>When creating a solution like this one, one thing to be mindful of is your use of tokens. An early version of this solution took approximately twenty minutes to create synthetic tests and ultimately led to severe rate-limiting.</p>
<p>Another issue faced during the building process was striking a balance between creating a template that facilitates the creation of a Playwright script and having an LLM create Playwright scripts based on prompts that didn't feel cookie-cutter. While using a more LLM approach an issue faced was that the scripts often didn't work or were based on parameters that didn't exist and a more templated approach was more reliable but felt repetitive. The final version of this solution attempted to balance this by using elements of the template while adjusting the LLM parameter of temperature, which controls the randomness or creativity of a large language model's output.</p>
<p>While testing this solution, a failing test also emerged that required navigating past a pop-up. In more complex cases, this may serve as a building block that requires additional domain knowledge to create a complete passing Playwright test.</p>
<h2>How to get started</h2>
<h3>Prerequisites</h3>
<ul>
<li>The version of Python that is used is Python 3.12.1 but you can use any version of Python higher than 3.10.</li>
<li>This application uses Elastic Observability version 9.1.2, but you can use any version of Elastics Observability that is higher than 8.10. You can also use <a href="https://www.elastic.co/cloud/serverless">Elastic Cloud Serverless</a> as well.</li>
<li>You will also need an OpenAI API key to use the LLM capabilities of this application. You will want to configure an environment variable for your OpenAI API Key, which you can find on the API keys page in <a href="https://platform.openai.com/api-keys">OpenAI's developer portal</a>.</li>
</ul>
<h3>Step 1: Install the packages and clone the repository</h3>
<p>In order for this MCP server to run locally you will need to install the the following packages:</p>
<pre><code class="language-shell">pip install fastmcp openai
npm install -g playwright @elastic/synthetics
</code></pre>
<p>You will use <a href="https://gofastmcp.com/getting-started/welcome">FastMCP 2.0</a> to create the MCP server, and <a href="https://github.com/openai/openai-python">OpenAI</a> to generate tests based on prompts that you provide. Additionally, you will want to clone the repository to obtain a local copy of the server.</p>
<h3>Step 2: Set up a configuration file in Warp</h3>
<p>Inside of Warp, you will want to go to the side panel, where it says MCP servers and where it says “add”.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/mcp-elastic-synthetics/02-add-mcp.jpg" alt="Add MCP Server" /></p>
<p>After that, you will be prompted to add a JSON configuration file that should resemble the following. Be sure to add your own Kibana URL, update the correct path, and include your own keys and tokens.</p>
<pre><code class="language-json">{
 &quot;elastic-synthetics&quot;: {
   &quot;command&quot;: &quot;python&quot;,
   &quot;args&quot;: [&quot;elastic_synthetics_server.py&quot;],
   &quot;env&quot;: {
     &quot;PYTHONPATH&quot;: &quot;.&quot;,
     &quot;ELASTIC_KIBANA_URL&quot;: &quot;https://your-kibana-url.elastic-cloud.com&quot;,
     &quot;ELASTIC_API_KEY&quot;: &quot;your-api-key-here&quot;,
     &quot;ELASTIC_PROJECT_ID&quot;: &quot;mcp-synthetics-demo&quot;,
     &quot;ELASTIC_SPACE&quot;: &quot;default&quot;,
     &quot;ELASTIC_AUTO_PUSH&quot;: &quot;true&quot;,
     &quot;ELASTIC_USE_JAVASCRIPT&quot;: &quot;false&quot;,
     &quot;ELASTIC_INSTALL_DEPENDENCIES&quot;: &quot;true&quot;,
     &quot;OPENAI_API_KEY&quot;: &quot;sk-your-openai-key&quot;,
     &quot;LLM_MODEL&quot;: &quot;gpt-4o&quot;
   },
   &quot;working_directory&quot;: &quot;/path/to/your/file&quot;,
   &quot;start_on_launch&quot;: true 
   }
}
</code></pre>
<h3>Step 3: Ask a question or call the tools directly</h3>
<p>Now that you've set up locally, you will want to toggle agent mode and select the LLM you wish to use. The reason why Gemini-Pro-2.5 was chosen for this blog post is that it provides a straightforward answer, while other LLMs selected returned a very lengthy response.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/mcp-elastic-synthetics/03-agent-mode.jpg" alt="Agent mode" /></p>
<p>To start using the MCP tools, from your MCP server, you can ask a question that contains the test name, URL, prompt, and schedule.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/mcp-elastic-synthetics/04-full-question-answer.jpg" alt="Full question and answer" /></p>
<p>You can also call the directly by typing <code>llm_create_and_deploy_test_from_prompt()</code> and the program will prompt you for the relevant details:<br />
<img src="https://www.elastic.co/observability-labs/assets/images/mcp-elastic-synthetics/05-call-mcp-tool.jpg" alt="Call MCP Tool" /></p>
<p>Inside Kibana, you should see your monitor listed if you click under Applications and select Monitors listed under Synthetics. You can also find a link to your monitor in the response of your MCP tool.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/mcp-elastic-synthetics/06-kibana-monitors.jpg" alt="Monitors in Kibana" /></p>
<h2>What's Going On Inside</h2>
<p>This code sample consists of three primary functions, which are MCP tools that you can call from your MCP client, including <code>diagnose_warp_mcp_config</code>, <code>create_and_deploy_browser_test</code> and <code>llm_create_and_deploy_test_from_prompt</code>.</p>
<h3>Debugging environment issues</h3>
<p>There were various issues that came up while creating this application around environment variable loading, so there was a need to create an MCP that could be called depending on errors that may be present.</p>
<p>The tool <code>diagnose_warp_mcp_config</code> kicks off with a decorator <code>@mcp.tool()</code> which allows it to be called and listed in the list of available tools. This tool is designed to help debug issues with Elastic-specific environment variables for troubleshooting purposes. First, it loads in the environment variables and looks for the Elastic specific variables, after it does some security masking so it doesn't show any variables and hides sensitive information like API keys in the output, showing only the first eight characters followed by &quot;...&quot;. This tool determines if the minimum required credentials (Kibana URL and API Key) are present to proceed with deployment and provides a report letting you know to address any issues that may exist.</p>
<pre><code class="language-py">@mcp.tool()
def diagnose_warp_mcp_config() -&gt; Dict[str, Any]:
   &quot;&quot;&quot;Diagnose Warp MCP environment configuration for Elastic Synthetics&quot;&quot;&quot;
   try:
       env_vars = load_env_from_warp_mcp()
      
       # Check for required variables
       kibana_url = env_vars.get('ELASTIC_KIBANA_URL') or env_vars.get('KIBANA_URL')
       api_key = env_vars.get('ELASTIC_API_KEY') or env_vars.get('API_KEY')
       project_id = env_vars.get('ELASTIC_PROJECT_ID') or env_vars.get('PROJECT_ID')
       space = env_vars.get('ELASTIC_SPACE') or env_vars.get('SPACE', 'default')
      
       # Mask sensitive values for display
       masked_vars = {}
       for key, value in env_vars.items():
           if 'API_KEY' in key or 'TOKEN' in key:
               masked_vars[key] = f&quot;{value[:8]}...&quot; if value and len(value) &gt; 8 else &quot;***&quot;
           else:
               masked_vars[key] = value
      
       deployment_ready = bool(kibana_url and api_key)
      
       return safe_json_response({
           &quot;status&quot;: &quot;success&quot;,
           &quot;environment_variables&quot;: masked_vars,
           &quot;required_check&quot;: {
               &quot;kibana_url&quot;: bool(kibana_url),
               &quot;api_key&quot;: bool(api_key),
               &quot;project_id&quot;: bool(project_id),
               &quot;space&quot;: bool(space)
           },
           &quot;deployment_ready&quot;: deployment_ready,
           &quot;recommendations&quot;: [
               &quot;Environment variables detected&quot; if env_vars else &quot;No environment variables found&quot;,
               &quot;Kibana URL configured&quot; if kibana_url else &quot;Missing ELASTIC_KIBANA_URL or KIBANA_URL&quot;,
               &quot;API Key configured&quot; if api_key else &quot;Missing ELASTIC_API_KEY or API_KEY&quot;,
               &quot;Ready for deployment&quot; if deployment_ready else &quot;Missing required credentials&quot;
           ]
       })
      
   except Exception as e:
       return safe_json_response({
           &quot;status&quot;: &quot;error&quot;,
           &quot;error&quot;: str(e),
           &quot;error_type&quot;: type(e).__name__
       })
</code></pre>
<h3>Creating synthetic tests based on a template</h3>
<p>While developing this solution to generate tests based on a prompt, the process wasn't always smooth. Early versions encountered issues with accuracy, hallucinations, and the creation of loops. To make progress, a version that relied on creating a test template to verify the mechanics of the solution, such as whether the test could pass and be deployed to Elastic correctly, was a logical next step.</p>
<p>This solution automates the entire process of creating a synthetic browser test that will regularly check if a website is working correctly, then deploys it to Elastic Observability Synthetics. Similar to <code>diagnose_warp_mcp_config</code>, the MCP tool <code>create_and_deploy_browser_test</code> starts with the decorator <code>@mcp.tool()</code> and checks to make sure that the proper environment variables are loaded.</p>
<p>From there, it creates a TypeScript test file that is based on templates and generates dynamic test steps based on the target website's characteristics, including navigating to the website, verifying the page title exists, checking page load performance, taking a screenshot, verifying page content is visible, and finally saves the test file in a <code>synthetic_tests</code> directory.</p>
<p>Finally, it wraps Elastic's CLI tool <code>@elastic/synthetics</code> to push the test to Kibana, allowing you to set which geographic locations to run tests from, how often to run the test, and the project and workspace settings.</p>
<p>You check out the full code for this MCP tool <a href="https://github.com/JessicaGarson/MCP-Elastic-Synthetics/blob/main/elastic_synthetics_server.py#L943">here.</a></p>
<h3>Creating synthetic tests based on a prompt</h3>
<p>While creating browser tests based on a templated approach is a good starting point, it felt generic and cookie-cutter. But it made a helpful structure to build an LLM-based function on top of.</p>
<p>The MCP tool <code>llm_create_and_deploy_test_from_prompt</code> begins by ensuring that basic parameters, including locations, schedule, and directories, are listed. Additionally, it aims to learn more about the target website to inform the AI and initialize the OpenAI client and model, which is GPT-4o.</p>
<p>After setting up the LLM, it converts natural language requests into actual Playwright test code, then cleans and validates the AI-generated code to prevent issues like injection attacks or malformed syntax. It draws inspiration from the templated approach, wrapping AI-generated steps within a proven, reliable test framework template. Finally, it deploys the test to Elastic in a similar manner to the previous tool.</p>
<p>You can find the code for this tool <a href="https://github.com/JessicaGarson/MCP-Elastic-Synthetics/blob/main/elastic_synthetics_server.py#L1559">here</a>.</p>
<h2>Conclusion and next steps</h2>
<p>Synthetic monitoring in Elastic Observability makes it easy to test complete user journeys and keep your site reliable, with simple setup and a Playwright integration. A tool like this can provide a starting point for tests that you can iterate on after.</p>
<p>A solution like this is just the start of an MCP implementation that automatically generates Playwright tests for you and can be expanded in the future to include heartbeat monitors, utilize the <a href="https://github.com/microsoft/playwright-mcp">Playwright MCP server</a>, or consider experimenting with <a href="https://www.anthropic.com/news/claude-for-chrome">Claude for Chrome</a> to create synthetic testing.</p>
<p>Check out more articles on <a href="https://www.elastic.co/observability-labs/blog/tag/synthetics">Observability Labs on Synthetic Monitoring</a></p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/mcp-elastic-synthetics/retro.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[Monitor dbt pipelines with Elastic Observability]]></title>
            <link>https://www.elastic.co/observability-labs/blog/monitor-dbt-pipelines-with-elastic-observability</link>
            <guid isPermaLink="false">monitor-dbt-pipelines-with-elastic-observability</guid>
            <pubDate>Fri, 26 Jul 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[Learn how to set up a dbt monitoring system with Elastic that proactively alerts on data processing cost spikes, anomalies in rows per table, and data quality test failures]]></description>
            <content:encoded><![CDATA[<p>In the Data Analytics team within the Observability organization in Elastic, we use <a href="https://www.getdbt.com/product/what-is-dbt">dbt (dbt™, data build tool)</a> to execute our SQL data transformation pipelines. dbt is a SQL-first transformation workflow that lets teams quickly and collaboratively deploy analytics code. In particular, we use <a href="https://docs.getdbt.com/docs/core/installation-overview">dbt core</a>, the <a href="https://github.com/dbt-labs/dbt-core">open-source project</a>, where you can develop from the command line and run your dbt project.</p>
<p>Our data transformation pipelines run daily and process the data that feed our internal dashboards, reports, analyses, and Machine Learning (ML) models.</p>
<p>There have been incidents in the past when the pipelines have failed, the source tables contained wrong data or we have introduced a change into our SQL code that has caused data quality issues, and we only realized once we saw it in a weekly report that was showing an anomalous number of records. That’s why we have built a monitoring system that proactively alerts us about these types of incidents as soon as they happen and helps us with visualizations and analyses to understand their root cause, saving us several hours or days of manual investigations.</p>
<p>We have leveraged our own Observability Solution to help solve this challenge, monitoring the entire lifecycle of our dbt implementation. This setup enables us to track the behavior of our models and conduct data quality testing on the final tables. We export dbt process logs from run jobs and tests into Elasticsearch and utilize Kibana to create dashboards, set up alerts, and configure Machine Learning jobs to monitor and assess issues.</p>
<p>The following diagram shows our complete architecture. In a follow-up article, we’ll also cover how we observe our python data processing and ML model processes using OTEL and Elastic - stay tuned.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/monitor-dbt-pipelines-with-elastic-observability/architecture.png" alt="1 - architecture" /></p>
<h2>Why monitor dbt pipelines with Elastic?</h2>
<p>With every invocation, dbt generates and saves one or more JSON files called <a href="https://docs.getdbt.com/reference/artifacts/dbt-artifacts">artifacts</a> containing log data on the invocation results. <code>dbt run</code> and <code>dbt test</code> invocation logs are <a href="https://docs.getdbt.com/reference/artifacts/run-results-json">stored in the file <code>run_results.json</code></a>, as per the dbt documentation:</p>
<blockquote>
<p>This file contains information about a completed invocation of dbt, including timing and status info for each node (model, test, etc) that was executed. In aggregate, many <code>run_results.json</code> can be combined to calculate average model runtime, test failure rates, the number of record changes captured by snapshots, etc.</p>
</blockquote>
<p>Monitoring <code>dbt run</code> invocation logs can help solve several issues, including tracking and alerting about table volumes, detecting excessive slot time from resource-intensive models, identifying cost spikes due to slot time or volume, and pinpointing slow execution times that may indicate scheduling issues. This system was crucial when we merged a PR with a change in our code that had an issue, producing a sudden drop in the number of daily rows in upstream Table A. By ingesting the <code>dbt run</code> logs into Elastic, our anomaly detection job quickly identified anomalies in the daily row counts for Table A and its downstream tables, B, C, and D. The Data Analytics team received an alert notification about the issue, allowing us to promptly troubleshoot, fix and backfill the tables before it affected the weekly dashboards and downstream ML models.</p>
<p>Monitoring <code>dbt test</code> invocation logs can also address several issues, such as identifying duplicates in tables, detecting unnoticed alterations in allowed values for specific fields through validation of all enum fields, and resolving various other data processing and quality concerns. With dashboards and alerts on data quality tests, we proactively identify issues like duplicate keys, unexpected category values, and increased nulls, ensuring data integrity. In our team, we had an issue where a change in one of our raw lookup tables produced duplicated rows in our user table, doubling the number of users reported. By ingesting the <code>dbt test</code> logs into Elastic, our rules detected that some duplicate tests had failed. The team received an alert notification about the issue, allowing us to troubleshoot it right away by finding the upstream table that was the root cause. These duplicates meant that downstream tables had to process 2x the amount of data, creating a spike in the bytes processed and slot time. The anomaly detection and alerts on the <code>dbt run</code> logs also helped us spot these spikes for individual tables and allowed us to quantify the impact on our billing.</p>
<p>Processing our dbt logs with Elastic and Kibana allows us to obtain real-time insights, helps us quickly troubleshoot potential issues, and keeps our data transformation processes running smoothly. We set up anomaly detection jobs and alerts in Kibana to monitor the number of rows processed by dbt, the slot time, and the results of the tests. This lets us catch real-time incidents, and by promptly identifying and fixing these issues, Elastic makes our data pipeline more resilient and our models more cost-effective, helping us stay on top of cost spikes or data quality issues.</p>
<p>We can also correlate this information with other events ingested into Elastic, for example using the <a href="https://www.elastic.co/guide/en/enterprise-search/current/connectors-github.html">Elastic Github connector</a>, we can correlate data quality test failures or other anomalies with code changes to find the root cause of the commit or PR that caused the issues. By ingesting application logs into Elastic, we can also analyze if these issues in our pipelines have affected downstream applications, increasing latency, throughput or error rates using APM. Ingesting billing, revenue data or web traffic, we could also see the impact in business metrics.</p>
<h2>How to export dbt invocation logs to Elasticsearch</h2>
<p>We use the <a href="https://elasticsearch-py.readthedocs.io/en">Python Elasticsearch client</a> to send the dbt invocation logs to Elastic after we run our <code>dbt run</code> and <code>dbt test</code> processes daily in production. The setup just requires you to install the <a href="https://elasticsearch-py.readthedocs.io/en/v8.14.0/quickstart.html#installation">Elasticsearch Python client</a> and obtain your Elastic Cloud ID (go to <a href="https://cloud.elastic.co/deployments/">https://cloud.elastic.co/deployments/</a>, select your deployment and find the <code>Cloud ID</code>) and Elastic Cloud API Key <a href="https://elasticsearch-py.readthedocs.io/en/v8.14.0/quickstart.html#connecting">(following this guide)</a></p>
<p>This python helper function will index the results from your <code>run_results.json</code> file to the specified index. You just need to export the variables to the environment:</p>
<ul>
<li><code>RESULTS_FILE</code>: path to your <code>run_results.json</code> file</li>
<li><code>DBT_RUN_LOGS_INDEX</code>: the name you want to give to dbt run logs index in Elastic, e.g. <code>dbt_run_logs</code></li>
<li><code>DBT_TEST_LOGS_INDEX</code>: the name you want to give to the dbt test logs index in Elastic, e.g. <code>dbt_test_logs</code></li>
<li><code>ES_CLUSTER_CLOUD_ID</code></li>
<li><code>ES_CLUSTER_API_KEY</code></li>
</ul>
<p>Then call the function <code>log_dbt_es</code> from your python code or save this code as a python script and run it after executing your <code>dbt run</code> or <code>dbt test</code> commands:</p>
<pre><code>from elasticsearch import Elasticsearch, helpers
import os
import sys
import json

def log_dbt_es():
   RESULTS_FILE = os.environ[&quot;RESULTS_FILE&quot;]
   DBT_RUN_LOGS_INDEX = os.environ[&quot;DBT_RUN_LOGS_INDEX&quot;]
   DBT_TEST_LOGS_INDEX = os.environ[&quot;DBT_TEST_LOGS_INDEX&quot;]
   es_cluster_cloud_id = os.environ[&quot;ES_CLUSTER_CLOUD_ID&quot;]
   es_cluster_api_key = os.environ[&quot;ES_CLUSTER_API_KEY&quot;]


   es_client = Elasticsearch(
       cloud_id=es_cluster_cloud_id,
       api_key=es_cluster_api_key,
       request_timeout=120,
   )


   if not os.path.exists(RESULTS_FILE):
       print(f&quot;ERROR: {RESULTS_FILE} No dbt run results found.&quot;)
       sys.exit(1)


   with open(RESULTS_FILE, &quot;r&quot;) as json_file:
       results = json.load(json_file)
       timestamp = results[&quot;metadata&quot;][&quot;generated_at&quot;]
       metadata = results[&quot;metadata&quot;]
       elapsed_time = results[&quot;elapsed_time&quot;]
       args = results[&quot;args&quot;]
       docs = []
       for result in results[&quot;results&quot;]:
           if result[&quot;unique_id&quot;].split(&quot;.&quot;)[0] == &quot;test&quot;:
               result[&quot;_index&quot;] = DBT_TEST_LOGS_INDEX
           else:
               result[&quot;_index&quot;] = DBT_RUN_LOGS_INDEX
           result[&quot;@timestamp&quot;] = timestamp
           result[&quot;metadata&quot;] = metadata
           result[&quot;elapsed_time&quot;] = elapsed_time
           result[&quot;args&quot;] = args
           docs.append(result)
       _ = helpers.bulk(es_client, docs)
   return &quot;Done&quot;

# Call the function
log_dbt_es()
</code></pre>
<p>If you want to add/remove any other fields from <code>run_results.json</code>, you can modify the above function to do it.</p>
<p>Once the results are indexed, you can use Kibana to create Data Views for both indexes and start exploring them in Discover.</p>
<p>Go to Discover, click on the data view selector on the top left and “Create a data view”.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/monitor-dbt-pipelines-with-elastic-observability/discover-create-dataview.png" alt="2 - discover create a data view" /></p>
<p>Now you can create a data view with your preferred name. Do this for both dbt run (<code>DBT_RUN_LOGS_INDEX</code> in your code) and dbt test (<code>DBT_TEST_LOGS_INDEX</code> in your code) indices:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/monitor-dbt-pipelines-with-elastic-observability/create-dataview.png" alt="3 - create a data view" /></p>
<p>Going back to Discover, you’ll be able to select the Data Views and explore the data.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/monitor-dbt-pipelines-with-elastic-observability/discover-logs-explorer.png" alt="4 - discover logs explorer" /></p>
<h2>dbt run alerts, dashboards and ML jobs</h2>
<p>The invocation of <a href="https://docs.getdbt.com/reference/commands/run"><code>dbt run</code></a> executes compiled SQL model files against the current database. <code>dbt run</code> invocation logs contain the <a href="https://docs.getdbt.com/reference/artifacts/run-results-json">following fields</a>:</p>
<ul>
<li><code>unique_id</code>: Unique model identifier</li>
<li><code>execution_time</code>: Total time spent executing this model run</li>
</ul>
<p>The logs also contain the following metrics about the job execution from the adapter:</p>
<ul>
<li><code>adapter_response.bytes_processed</code></li>
<li><code>adapter_response.bytes_billed</code></li>
<li><code>adapter_response.slot_ms</code></li>
<li><code>adapter_response.rows_affected</code></li>
</ul>
<p>We have used Kibana to set up <a href="https://www.elastic.co/guide/en/machine-learning/current/ml-ad-run-jobs.html">Anomaly Detection jobs</a> on the above-mentioned metrics. You can configure a <a href="https://www.elastic.co/guide/en/machine-learning/current/ml-anomaly-detection-job-types.html#multi-metric-jobs">multi-metric job</a> split by <code>unique_id</code> to be alerted when the sum of rows affected, slot time consumed, or bytes billed is anomalous per table. You can track one job per metric. If you have built a dashboard of the metrics per table, you can use <a href="https://www.elastic.co/guide/en/machine-learning/8.14/ml-jobs-from-lens.html">this shortcut</a> to create the Anomaly Detection job directly from the visualization. After the jobs are created and are running on incoming data, you can <a href="https://www.elastic.co/guide/en/machine-learning/current/ml-ad-view-results.html">view the jobs</a> and add them to a dashboard using the three dots button in the anomaly timeline:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/monitor-dbt-pipelines-with-elastic-observability/ml-job-add-to-dashboard.png" alt="5 - add ML job to dashboard" /></p>
<p>We have used the <a href="https://www.elastic.co/guide/en/machine-learning/current/ml-configuring-alerts.html">ML job to set up alerts</a> that send us emails/slack messages when anomalies are detected. Alerts can be created directly from the Jobs (Machine Learning &gt; Anomaly Detection Jobs) page, by clicking on the three dots at the end of the ML job row:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/monitor-dbt-pipelines-with-elastic-observability/ml-job-create-alert.png" alt="6 - create alert from ML job" /></p>
<p>We also use <a href="https://www.elastic.co/guide/en/kibana/current/dashboard.html">Kibana dashboards</a> to visualize the anomaly detection job results and related metrics per table, to identify which tables consume most of our resources, to have visibility on their temporal evolution, and to measure aggregated metrics that can help us understand month over month changes.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/monitor-dbt-pipelines-with-elastic-observability/ml-job-dashboard.png" alt="7 - ML job in dashboard" />
<img src="https://www.elastic.co/observability-labs/assets/images/monitor-dbt-pipelines-with-elastic-observability/dashboard-slot-time.png" alt="8 - dashboard slot time chart" />
<img src="https://www.elastic.co/observability-labs/assets/images/monitor-dbt-pipelines-with-elastic-observability/dashboard-aggregated-metrics.png" alt="9 - dashboard aggregated metrics" /></p>
<h2>dbt test alerts and dashboards</h2>
<p>You may already be familiar with <a href="https://docs.getdbt.com/docs/build/data-tests">tests in dbt</a>, but if you’re not, dbt data tests are assertions you make about your models. Using the command <a href="https://docs.getdbt.com/reference/commands/test"><code>dbt test</code></a>, dbt will tell you if each test in your project passes or fails. <a href="https://docs.getdbt.com/docs/build/data-tests#example">Here is an example of how to set them up</a>. In our team, we use out-of-the-box dbt tests (<code>unique</code>, <code>not_null</code>, <code>accepted_values</code>, and <code>relationships</code>) and the packages <a href="https://hub.getdbt.com/dbt-labs/dbt_utils/latest/">dbt_utils</a> and <a href="https://hub.getdbt.com/calogica/dbt_expectations/latest/">dbt_expectations</a> for some extra tests. When the command <code>dbt test</code> is run, it generates logs that are stored in <code>run_results.json</code>.</p>
<p>dbt test logs contain the <a href="https://docs.getdbt.com/reference/artifacts/run-results-json">following fields</a>:</p>
<ul>
<li><code>unique_id</code>: Unique test identifier, tests contain the “test” prefix in their unique identifier</li>
<li><code>status</code>: result of the test, <code>pass</code> or <code>fail</code></li>
<li><code>execution_time</code>: Total time spent executing this test</li>
<li><code>failures</code>: will be 0 if the test passes and 1 if the test fails</li>
<li><code>message</code>: If the test fails, reason why it failed</li>
</ul>
<p>The logs also contain the metrics about the job execution from the adapter.</p>
<p>We have set up alerts on document count (see <a href="https://www.elastic.co/guide/en/observability/8.14/custom-threshold-alert.html">guide</a>) that will send us an email / slack message when there are any failed tests. The rule for the alerts is set up on the dbt test Data View that we have created before, the query filtering on <code>status:fail</code> to obtain the logs for the tests that have failed, and the rule condition is document count bigger than 0.
Whenever there is a failure in any test in production, we get an alert with links to the alert details and dashboards to be able to troubleshoot them:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/monitor-dbt-pipelines-with-elastic-observability/email-alert.png" alt="10 - alert" /></p>
<p>We have also built a dashboard to visualize the tests run, tests failed, and their execution time and slot time to have a historical view of the test run:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/monitor-dbt-pipelines-with-elastic-observability/dashboard-tests.png" alt="11 - dashboard dbt tests" /></p>
<h2>Finding Root Causes with the AI Assistant</h2>
<p>The most effective way for us to analyze these multiple sources of information is using the AI Assistant to help us troubleshoot the incidents. In our case, we got an alert about a test failure, and we used the AI Assistant to give us context on what happened. Then we asked if there were any downstream consequences, and the AI Assistant interpreted the results of the Anomaly Detection job, which indicated a spike in slot time for one of our downstream tables and the increase of the slot time vs. the baseline. Then, we asked for the root cause, and the AI Assistant was able to find and provide us a link to a PR from our Github changelog that matched the start of the incident and was the most probable cause.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/monitor-dbt-pipelines-with-elastic-observability/ai-assistant.png" alt="12 - ai assistant troubleshoot" /></p>
<h2>Conclusion</h2>
<p>As a Data Analytics team, we are responsible for guaranteeing that the tables, charts, models, reports, and dashboards we provide to stakeholders are accurate and contain the right sources of information. As teams grow, the number of models we own becomes larger and more interconnected, and it isn’t easy to guarantee that everything is running smoothly and providing accurate results. Having a monitoring system that proactively alerts us on cost spikes, anomalies in row counts, or data quality test failures is like having a trusted companion that will alert you in advance if something goes wrong and help you get to the root cause of the issue.</p>
<p>dbt invocation logs are a crucial source of information about the status of our data pipelines, and Elastic is the perfect tool to extract the maximum potential out of them. Use this blog post as a starting point for utilizing your dbt logs to help your team achieve greater reliability and peace of mind, allowing them to focus on more strategic tasks rather than worrying about potential data issues.</p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/monitor-dbt-pipelines-with-elastic-observability/monitoring-dbt-with-elastic.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[Monitor OpenAI API and GPT models with OpenTelemetry and Elastic]]></title>
            <link>https://www.elastic.co/observability-labs/blog/monitor-openai-api-gpt-models-opentelemetry</link>
            <guid isPermaLink="false">monitor-openai-api-gpt-models-opentelemetry</guid>
            <pubDate>Tue, 04 Apr 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[Get ready to be blown away by this game-changing approach to monitoring cutting-edge ChatGPT applications! As the ChatGPT phenomenon takes the world by storm, it's time to supercharge your monitoring game with OpenTelemetry and Elastic Observability.]]></description>
            <content:encoded><![CDATA[<p>ChatGPT is so hot right now, it broke the internet. As an avid user of ChatGPT and a developer of ChatGPT applications, I am incredibly excited by the possibilities of this technology. What I see happening is that there will be exponential growth of ChatGPT-based solutions, and people are going to need to monitor those solutions.</p>
<p>Since this is a pretty new technology, we wouldn’t want to burden our shiny new code with proprietary technology, would we? No, we would not, and that is why we are going to use OpenTelemetry to monitor our ChatGPT code in this blog. This is particularly relevant for me as I recently created a service to generate meeting notes from Zoom calls. If I am to release this into the wild, how much is it going to cost me and how do I make sure it is available?</p>
<h2>OpenAI APIs to the rescue</h2>
<p>The OpenAI API is pretty awesome, there is no doubt. It also gives us the information shown below in each response to each API call, which can help us with understanding what we are being charged. By using the token counts, the model, and the pricing that OpenAI has put up on its website, we can calculate the cost. The question is, how do we get this information into our monitoring tools?</p>
<pre><code class="language-python">{
  &quot;choices&quot;: [
    {
      &quot;finish_reason&quot;: &quot;length&quot;,
      &quot;index&quot;: 0,
      &quot;logprobs&quot;: null,
      &quot;text&quot;: &quot;\n\nElastic is an amazing observability tool because it provides a comprehensive set of features for monitoring&quot;
    }
  ],
  &quot;created&quot;: 1680281710,
  &quot;id&quot;: &quot;cmpl-70CJq07gibupTcSM8xOWekOTV5FRF&quot;,
  &quot;model&quot;: &quot;text-davinci-003&quot;,
  &quot;object&quot;: &quot;text_completion&quot;,
  &quot;usage&quot;: {
    &quot;completion_tokens&quot;: 20,
    &quot;prompt_tokens&quot;: 9,
    &quot;total_tokens&quot;: 29
  }
}
</code></pre>
<h2>OpenTelemetry to the rescue</h2>
<p><a href="https://www.elastic.co/blog/opentelemetry-observability">OpenTelemetry</a> is truly a fantastic piece of work. It has had so much adoption and work committed to it over the years, and it seems to really be getting to the point where we can call it the Linux of Observability. We can use it to record logs, metrics, and traces and get those in a vendor neutral way into our favorite observability tool — in this case, Elastic Observability.</p>
<p>With the latest and greatest otel libraries in Python, we can auto-instrument external calls, and this will help us understand how OpenAI calls are performing. Let's take a sneak peek at our sample Python application, which implements Flask and the ChatGPT API and also has OpenTelemetry. If you want to try this yourself, take a look at the GitHub link at the end of this blog and follow these steps.</p>
<h3>Set up Elastic Cloud account (if you already don’t have one)</h3>
<ol>
<li>Sign up for a two-week free trial at <a href="https://www.elastic.co/cloud/elasticsearch-service/signup">https://www.elastic.co/cloud/elasticsearch-service/signup</a>.</li>
<li>Create a deployment.</li>
</ol>
<p>Once you are logged in, click <strong>Add integrations</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/monitor-openai-api-gpt-models-opentelemetry/blog-elastic-cloud-deployment-add-integrations.png" alt="elastic cloud deployment add integrations" /></p>
<p>Click on <strong>APM Integration</strong>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/monitor-openai-api-gpt-models-opentelemetry/blog-elastic-apm-integration.png" alt="elastic apm integration" /></p>
<p>Then scroll down to get the details you need for this blog:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/monitor-openai-api-gpt-models-opentelemetry/blog-elastic-opentelemetry-download.png" alt="elastic opentelemetry download" /></p>
<p>Be sure to set the following Environment variables, replacing the variables with data you get from Elastic as above and OpenAI from <a href="https://platform.openai.com/account/api-keys">here</a>, and then run these export commands on the command line.</p>
<pre><code class="language-bash">export OPEN_AI_KEY=sk-abcdefgh5ijk2l173mnop3qrstuvwxyzab2cde47fP2g9jij
export OTEL_EXPORTER_OTLP_AUTH_HEADER=abc9ldeofghij3klmn
export OTEL_EXPORTER_OTLP_ENDPOINT=https://123456abcdef.apm.us-west2.gcp.elastic-cloud.com:443
</code></pre>
<p>And install the following Python libraries:</p>
<pre><code class="language-python">pip3 install opentelemetry-api
pip3 install opentelemetry-sdk
pip3 install opentelemetry-exporter-otlp
pip3 install opentelemetry-instrumentation
pip3 install opentelemetry-instrumentation-requests
pip3 install openai
pip3 install flask
</code></pre>
<p>Here is a look at the code we are using for the example application. In the real world, this would be your own code. All this does is call OpenAI APIs with the following message: “Why is Elastic an amazing observability tool?”</p>
<pre><code class="language-python">import openai
from flask import Flask
import monitor  # Import the module
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
import urllib
import os
from opentelemetry import trace
from opentelemetry.sdk.resources import SERVICE_NAME, Resource
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.instrumentation.requests import RequestsInstrumentor

# OpenTelemetry setup up code here, feel free to replace the “your-service-name” attribute here.
resource = Resource(attributes={
    SERVICE_NAME: &quot;your-service-name&quot;
})
provider = TracerProvider(resource=resource)
processor = BatchSpanProcessor(OTLPSpanExporter(endpoint=os.getenv('OTEL_EXPORTER_OTLP_ENDPOINT'),
        headers=&quot;Authorization=Bearer%20&quot;+os.getenv('OTEL_EXPORTER_OTLP_AUTH_HEADER')))
provider.add_span_processor(processor)
trace.set_tracer_provider(provider)
tracer = trace.get_tracer(__name__)
RequestsInstrumentor().instrument()



# Initialize Flask app and instrument it

app = Flask(__name__)
# Set OpenAI API key
openai.api_key = os.getenv('OPEN_AI_KEY')


@app.route(&quot;/completion&quot;)
@tracer.start_as_current_span(&quot;do_work&quot;)
def completion():
    response = openai.Completion.create(
        model=&quot;text-davinci-003&quot;,
        prompt=&quot;Why is Elastic an amazing observability tool?&quot;,
        max_tokens=20,
        temperature=0
    )
    return response.choices[0].text.strip()

if __name__ == &quot;__main__&quot;:
    app.run()
</code></pre>
<p>This code should be fairly familiar to anyone who has implemented OpenTelemetry with Python here — there is no specific magic. The magic happens inside the “monitor” code that you can use freely to instrument your own OpenAI applications.</p>
<h2>Monkeying around</h2>
<p>Inside the monitor.py code, you will see we do something called “Monkey Patching.” Monkey patching is a technique in Python where you dynamically modify the behavior of a class or module at runtime by modifying its attributes or methods. Monkey patching allows you to change the functionality of a class or module without having to modify its source code. It can be useful in situations where you need to modify the behavior of an existing class or module that you don't have control over or cannot modify directly.</p>
<p>What we want to do here is modify the behavior of the “Completion” call so we can steal the response metrics and add them to our OpenTelemetry spans. You can see how we do that below:</p>
<pre><code class="language-python">def count_completion_requests_and_tokens(func):
    @wraps(func)
    def wrapper(*args, **kwargs):
        counters['completion_count'] += 1
        response = func(*args, **kwargs)
        token_count = response.usage.total_tokens
        prompt_tokens = response.usage.prompt_tokens
        completion_tokens = response.usage.completion_tokens
        cost = calculate_cost(response)
        strResponse = json.dumps(response)
        # Set OpenTelemetry attributes
        span = trace.get_current_span()
        if span:
            span.set_attribute(&quot;completion_count&quot;, counters['completion_count'])
            span.set_attribute(&quot;token_count&quot;, token_count)
            span.set_attribute(&quot;prompt_tokens&quot;, prompt_tokens)
            span.set_attribute(&quot;completion_tokens&quot;, completion_tokens)
            span.set_attribute(&quot;model&quot;, response.model)
            span.set_attribute(&quot;cost&quot;, cost)
            span.set_attribute(&quot;response&quot;, strResponse)
        return response
    return wrapper
# Monkey-patch the openai.Completion.create function
openai.Completion.create = count_completion_requests_and_tokens(openai.Completion.create)
</code></pre>
<p>By adding all this data to our Span, we can actually send it to our OpenTelemetry OTLP endpoint (in this case it will be Elastic). The benefit of doing this is that you can easily use the data for search or to build dashboards and visualizations. In the final step, we also want to calculate the cost. We do this by implementing the following function, which will calculate the cost of a single request to the OpenAI APIs.</p>
<pre><code class="language-python">def calculate_cost(response):
    if response.model in ['gpt-4', 'gpt-4-0314']:
        cost = (response.usage.prompt_tokens * 0.03 + response.usage.completion_tokens * 0.06) / 1000
    elif response.model in ['gpt-4-32k', 'gpt-4-32k-0314']:
        cost = (response.usage.prompt_tokens * 0.06 + response.usage.completion_tokens * 0.12) / 1000
    elif 'gpt-3.5-turbo' in response.model:
        cost = response.usage.total_tokens * 0.002 / 1000
    elif 'davinci' in response.model:
        cost = response.usage.total_tokens * 0.02 / 1000
    elif 'curie' in response.model:
        cost = response.usage.total_tokens * 0.002 / 1000
    elif 'babbage' in response.model:
        cost = response.usage.total_tokens * 0.0005 / 1000
    elif 'ada' in response.model:
        cost = response.usage.total_tokens * 0.0004 / 1000
    else:
        cost = 0
    return cost
</code></pre>
<h2>Elastic to the rescue</h2>
<p>Once we are capturing all this data, it’s time to have some fun with it in Elastic. In Discover, we can see all the data points we sent over using the OpenTelemetry library:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/monitor-openai-api-gpt-models-opentelemetry/blog-elastic-discover-apm.png" alt="elastic discover apm" /></p>
<p>With these labels in place, it is very easy to build a dashboard. Take a look at this one I built earlier (<a href="https://github.com/davidgeorgehope/ChatGPTMonitoringWithOtel/blob/main/chatGPTDashboard.ndjson">which is also checked into my GitHub Repository</a>):</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/monitor-openai-api-gpt-models-opentelemetry/blog-elastic-labels-dashboard.png" alt="elastic labels dashboard" /></p>
<p>We can also see Transactions, Latency of the OpenAI service, and all the spans related to our ChatGPT service calls.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/monitor-openai-api-gpt-models-opentelemetry/blog-elastic-observability-service-name.png" alt="observability service name" /></p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/monitor-openai-api-gpt-models-opentelemetry/blog-elastic-your-service-name.png" alt="elastic your service name" /></p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/monitor-openai-api-gpt-models-opentelemetry/blog-elastic-api-openai.png" alt="elastic api openai" /></p>
<p>In the transaction view, we can also see how long specific OpenAI calls have taken:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/monitor-openai-api-gpt-models-opentelemetry/blog-elastic-latency-distribution.png" alt="elastic latency distribution" /></p>
<p>Some requests to OpenAI here have taken over 3 seconds. ChatGPT can be very slow, so it’s important for us to understand how slow this is and if users are becoming frustrated.</p>
<h2>Summary</h2>
<p>We looked at monitoring ChatGPT with OpenTelemetry with Elastic. ChatGPT is a worldwide phenomenon and it’s going to no doubt grow and grow, and pretty soon everyone will be using it. Because it can be slow to get responses out, it is critical that people are able to understand the performance of any code that is using this service.</p>
<p>There is also the issue of cost, since it’s incredibly important to understand if this service is eating into your margins and if what you are asking for is profitable for your business. With the current economic environment, we have to keep an eye on profitability.</p>
<p>Take a look at the code for this solution <a href="https://github.com/davidgeorgehope/ChatGPTMonitoringWithOtel">here</a>. And please feel free to use the “monitor” library to instrument your own OpenAI code.</p>
<p>Interested in learning more about Elastic Observability? Check out the following resources:</p>
<ul>
<li><a href="https://www.elastic.co/virtual-events/intro-to-elastic-observability">An Introduction to Elastic Observability</a></li>
<li><a href="https://www.elastic.co/training/observability-fundamentals">Observability Fundamentals Training</a></li>
<li><a href="https://www.elastic.co/observability/demo">Watch an Elastic Observability demo</a></li>
<li><a href="https://www.elastic.co/blog/observability-predictions-trends-2023">Observability Predictions and Trends for 2023</a></li>
</ul>
<p>And sign up for our <a href="https://www.elastic.co/virtual-events/emerging-trends-in-observability">Elastic Observability Trends Webinar</a> featuring AWS and Forrester, not to be missed!</p>
<p><em>In this blog post, we may have used third party generative AI tools, which are owned and operated by their respective owners. Elastic does not have any control over the third party tools and we have no responsibility or liability for their content, operation or use, nor for any loss or damage that may arise from your use of such tools. Please exercise caution when using AI tools with personal, sensitive or confidential information. Any data you submit may be used for AI training or other purposes. There is no guarantee that information you provide will be kept secure or confidential. You should familiarize yourself with the privacy practices and terms of use of any generative AI tools prior to use.</em></p>
<p><em>Elastic, Elasticsearch and associated marks are trademarks, logos or registered trademarks of Elasticsearch N.V. in the United States and other countries. All other company and product names are trademarks, logos or registered trademarks of their respective owners.</em></p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/monitor-openai-api-gpt-models-opentelemetry/opentelemetry-graphic-ad-2-1920x1080.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[Network monitoring with Elastic: Unifying network observability]]></title>
            <link>https://www.elastic.co/observability-labs/blog/network-monitoring-with-elastic-unifying-network-observability</link>
            <guid isPermaLink="false">network-monitoring-with-elastic-unifying-network-observability</guid>
            <pubDate>Mon, 16 Feb 2026 00:00:00 GMT</pubDate>
            <description><![CDATA[Learn how to unify network monitoring using Elastic observability and AI. We'll showcase how to correlate network data, identify root causes and fix issues.]]></description>
            <content:encoded><![CDATA[<h2>Introduction: The Network Monitoring Fragmentation Problem</h2>
<p>In five years working with Enterprise accounts at Elastic, I have heard the same challenge again and again:</p>
<p><strong>&quot;We have several network monitoring tools, and we would love to correlate all of them into one platform.&quot;</strong></p>
<p>For many organizations, the barrier to true correlation isn't a lack of data, but where that data lives. Frequently, we see SNMP metrics, flow data, and logs isolated in purpose-built silos or dashboards. Without a unified data store and a proper correlation engine, piecing together the full narrative — from a topology change to a performance degradation — becomes a manual, time-consuming puzzle.</p>
<p>When an incident happens, engineers become <strong>human correlation engines</strong> — manually jumping between systems, copying timestamps, cross-referencing device names, and trying to piece together what actually happened. A simple question like &quot;Did this interface failure impact application performance?&quot; requires querying multiple tools and mentally correlating the results.</p>
<p>The real cost isn't the tool licenses — it's the time lost during critical incidents.</p>
<p>This lab is my answer to a fundamental question: <strong>Can Elastic become the unified foundation that actually correlates network data?</strong></p>
<p>More importantly, it demonstrates that Elastic is fully ready for network operations — capable of ingesting diverse telemetry and using AI to correlate relationships, identify root causes, and resolve issues in seconds instead of hours.</p>
<h2>The Problem: Network Observability is Broken</h2>
<p>Let me paint a typical scenario I encounter with enterprise network teams:</p>
<p><strong>The Fragmented Reality:</strong></p>
<ul>
<li>No single source of truth</li>
<li>Manual correlation during incidents (15-30 minutes per event)</li>
<li>Fragmented teams (network vs. platform engineers)</li>
<li>Limited automation capabilities</li>
<li>No AI-powered analysis</li>
</ul>
<p><strong>When a link goes down at 2 AM:</strong></p>
<ul>
<li>Notice the alert - 2 minutes</li>
<li>Log into monitoring tool to see the metric - 3 minutes</li>
<li>Switch to traffic analyzer to check impact - 5 minutes</li>
<li>Open log management to search for related messages - 10 minutes</li>
<li>Manually correlate timestamps across systems - 8 minutes</li>
<li>Create a ticket and copy context from multiple tools - 8 minutes</li>
</ul>
<p><strong>Time to initial diagnosis: 36 minutes</strong></p>
<p>This workflow is expensive, error-prone, and doesn't scale.</p>
<h2>The Vision: Elastic as a Unified Network Observability Platform</h2>
<p>What if you could:</p>
<ul>
<li>Collect SNMP metrics, NetFlow, traps, and topology data in <strong>one platform</strong></li>
<li>Correlate network events with application performance <strong>automatically</strong></li>
<li>Generate executive dashboards without separate BI tools</li>
<li>Use <strong>AI to analyze incidents in seconds</strong>, not hours</li>
<li>Trigger alerting from network events</li>
</ul>
<p>This is what this lab aims to demonstrate.</p>
<h2>What I Built: A Production-Grade Network Simulation</h2>
<p>To demonstrate how Elastic unifies network data, I needed a realistic environment that generates real-world telemetry. Enter <strong>Containerlab</strong>  —  a Docker-based solution that enables us to create a network simulation framework.</p>
<h3>Lab Architecture</h3>
<p><img src="https://www.elastic.co/observability-labs/assets/images/network-monitoring-with-elastic-unifying-network-observability/lab-topology.jpg" alt="Lab Topology" /></p>
<p>I simulated a Service Provider core network with:</p>
<ul>
<li><strong>7 FRR routers</strong> forming an OSPF Area 0 mesh</li>
<li><strong>2 Ubuntu hosts</strong> for additional use cases</li>
<li><strong>2 Layer 2 switches</strong> for access layer segmentation</li>
<li><strong>3 telemetry collectors</strong> feeding Elastic Cloud</li>
</ul>
<p><strong>Total containers:</strong> 14</p>
<p><strong>Deployment time:</strong> 12-15 minutes (fully automated)</p>
<p><strong>Full deployment instructions and topology details are available in the <a href="https://github.com/DeBaker1974/Containerlab-OSPF">GitHub repository README</a>.</strong></p>
<h2>The Three Telemetry Pipelines: Proving Multi-Source Correlation</h2>
<p>What makes this lab production-ready is its <strong>hybrid observability approach</strong> — proving that Elastic can unify disparate network data sources.</p>
<table>
<thead>
<tr>
<th align="left">Pipeline</th>
<th align="left">Data Type</th>
<th align="left">Collection Method</th>
<th align="left">Collector</th>
<th align="left">Use Case</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><strong>SNMP Metrics</strong></td>
<td align="left">Interface stats, system health, LLDP topology</td>
<td align="left">Active polling</td>
<td align="left">OTEL Collector</td>
<td align="left">Capacity planning, trend analysis</td>
</tr>
<tr>
<td align="left"><strong>NetFlow</strong></td>
<td align="left">Traffic flows</td>
<td align="left">Push-based export</td>
<td align="left">Elastic Agent</td>
<td align="left">Top talkers, security investigation</td>
</tr>
<tr>
<td align="left"><strong>SNMP Traps</strong></td>
<td align="left">Interface up/down events</td>
<td align="left">Event-driven</td>
<td align="left">Logstash</td>
<td align="left">Real-time incident detection</td>
</tr>
</tbody>
</table>
<p>This unified architecture proves Elastic can replace multiple specialized network monitoring tools with a single platform.</p>
<h2>The Power of Correlation: One Platform, One Query</h2>
<p>When a network incident occurs, you need to answer questions like:</p>
<ul>
<li>Which interface failed? <em>(SNMP metrics)</em></li>
<li>What traffic was affected? <em>(NetFlow)</em></li>
<li>What was the sequence of events? <em>(SNMP traps)</em></li>
<li>Which devices are downstream? <em>(LLDP topology)</em></li>
</ul>
<p><strong>The Problem:</strong> modern tools offer separate modules glued together, forcing users to navigate different spaces for different sets of data.</p>
<p><strong>The Reality:</strong> You still have to pivot. You see a spike in the Metrics module, but to see why, you have to open the Logs module and manually align the time picker. The data lives in different tables or backends, making true correlation impossible without human intervention.</p>
<p><strong>The Elastic Difference:</strong> One Store, One Language, One AI</p>
<p>Elastic makes it simple. Whether it's an SNMP counter (metric), a NetFlow record (flow), or a Syslog message (log), it is all stored in a unified datastore powered by the Elasticsearch engine. This allows users to easily search across multiple datasets in a single query.</p>
<pre><code class="language-bash">FROM logs-*
| WHERE host.name == &quot;csr23&quot; AND interface.name == &quot;eth1&quot;
</code></pre>
<p><strong>Time required: 3 seconds</strong></p>
<p>Furthermore, as you will see later, the exact location of the data becomes agnostic to the user when leveraging the AI Assistant.</p>
<h2>Data Transformation: From Cryptic OIDs to Actionable Intelligence</h2>
<p>Raw SNMP traps are notoriously difficult to interpret at a glance. In our current lab setup, the data arrives looking like this:</p>
<pre><code class="language-bash">OID: 1.3.6.1.6.3.1.1.5.3
ifIndex: 2
ifDescr: eth1
</code></pre>
<p>While traditional Network Management Platforms (NMPs) handle OID translation natively, bringing that clarity into Elastic requires a specific configuration.</p>
<p>In this initial lab, we are intentionally working with this raw data to demonstrate how AI assistants can interpret these events even without pre-existing context.</p>
<p>However, the strategy for the next phase of this project is to implement Elasticsearch Ingest Pipelines. This will allow us to map raw OIDs to human-readable names. This step is crucial for bridging the gap between Network tools and Application Observability platforms, allowing network events to be instantly correlated with application errors and infrastructure logs.</p>
<p><strong>The Target State</strong></p>
<p>Once the pipeline is implemented in the next lab, we will transform that raw trap into searchable, meaningful data:</p>
<pre><code class="language-bash">{
  &quot;event.action&quot;: &quot;interface-down&quot;,
  &quot;host.name&quot;: &quot;csr23&quot;,
  &quot;interface.name&quot;: &quot;eth1&quot;,
  &quot;interface.oper_status_text&quot;: &quot;Link Down&quot;
}
</code></pre>
<p><strong>The result:</strong></p>
<ul>
<li>Human-readable fields</li>
<li>Searchable dimensions for filtering</li>
<li>Context for automation rules and dashboards</li>
<li>Correlation keys for joining with metrics and flows</li>
</ul>
<p>In our next blog post, we will walk through building the ingest pipeline that performs this transformation — step by step.</p>
<h2>Intelligent Alerting: From Noise to Actionable Intelligence</h2>
<p>Traditional network monitoring relies on simple threshold alerts — &quot;interface down,&quot; &quot;high CPU.&quot; These alerts flood your inbox but provide <strong>zero context</strong> about root cause, impact, or remediation.</p>
<h3>The Lab's Approach: ES|QL + AI Assistant</h3>
<p><strong>1. Semantic Detection with ES|QL</strong></p>
<p>Instead of generic threshold alerts, the lab uses ES|QL to detect specific event patterns:</p>
<pre><code class="language-bash">FROM logs-snmp.trap-prod
| WHERE snmp.trap_oid == &quot;1.3.6.1.6.3.1.1.5.3&quot;
| KEEP @timestamp, host.name, interface.name, message
</code></pre>
<p><strong>2. Automatic AI-Powered Investigation</strong></p>
<p>When the alert triggers, it invokes the <strong>Observability AI Assistant</strong> with a structured investigation prompt that:</p>
<ul>
<li>Performs immediate triage (which device, which interface, when)</li>
<li>Assesses OSPF impact and traffic rerouting</li>
<li>Correlates with other recent failures</li>
<li>Generates severity assessment and recommended actions</li>
</ul>
<h3>The Transformation</h3>
<table>
<thead>
<tr>
<th align="center">Traditional Alerting</th>
<th align="center">Intelligent Alerting (Elastic)</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center"><strong>Email: &quot;Interface down on csr23&quot;</strong></td>
<td align="center">Structured analysis with device context</td>
</tr>
<tr>
<td align="center"><strong>Manual investigation: 20-30 min</strong></td>
<td align="center">AI-automated investigation: 90 seconds</td>
</tr>
<tr>
<td align="center"><strong>Engineer correlates across tools</strong></td>
<td align="center">Automatic cross-source correlation</td>
</tr>
<tr>
<td align="center"><strong>No business impact assessment</strong></td>
<td align="center">Severity + recommended actions included</td>
</tr>
</tbody>
</table>
<h2>Accelerating Incident Response with the Elastic AI Assistant</h2>
<p>This is where the Elastic AI Assistant demonstrates its operational value — moving beyond passive data collection to actively interpret and explain network events in real-time</p>
<p>When an engineer views a trap document in Discover and asks:</p>
<p><em><strong>&quot;Explain this log message&quot;</strong></em></p>
<p>The AI Assistant provides comprehensive analysis including:</p>
<ul>
<li><strong>What happened:</strong> Plain-language explanation of the SNMP trap</li>
<li><strong>Device context:</strong> Router role, interface purpose, network position</li>
<li><strong>Impact analysis:</strong> OSPF neighbor status, traffic rerouting assessment</li>
<li><strong>Root cause possibilities:</strong> Physical layer, link layer, administrative causes</li>
<li><strong>Recommended actions:</strong> Immediate steps, investigation queries, validation checks</li>
<li><strong>Severity assessment:</strong> Business and technical impact rating</li>
</ul>
<h3>Manual Triage vs. AI-Assisted Investigation</h3>
<table>
<thead>
<tr>
<th align="left">Before</th>
<th align="left">After (Elastic AI)</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><strong>Google the OID → 5 min</strong></td>
<td align="left">Click &quot;Explain this log&quot; → 20 seconds</td>
</tr>
<tr>
<td align="left"><strong>Open network diagram → 3 min</strong></td>
<td align="left">Topology context auto-provided</td>
</tr>
<tr>
<td align="left"><strong>Query multiple tools → 10 min</strong></td>
<td align="left">Cross-source correlation instant</td>
</tr>
<tr>
<td align="left"><strong>Assess business impact → 5 min</strong></td>
<td align="left">Impact analysis auto-generated</td>
</tr>
<tr>
<td align="left"><strong>Total: ~28 minutes</strong></td>
<td align="left"><strong>Total: ~20 seconds</strong></td>
</tr>
</tbody>
</table>
<h2>The Value Proposition: One Platform, One Data Model, One AI</h2>
<h3>What This Lab Demonstrates</h3>
<p>Elastic provides:</p>
<ul>
<li><strong>One unified platform</strong> for metrics, logs, flows</li>
<li><strong>One data model</strong> (SemConv) for consistent correlation</li>
<li><strong>One search interface</strong> (Kibana) for all network data</li>
<li><strong>One AI assistant</strong> that understands all your network telemetry</li>
<li><strong>AI-powered alerting</strong> with automated investigation</li>
</ul>
<h3>Business Impact</h3>
<p><strong>Efficiency Gains:</strong></p>
<ul>
<li><strong>85% reduction in MTTR</strong> (36 min → 5 min for initial diagnosis)</li>
<li><strong>90% reduction</strong> in manual correlation time</li>
<li>Junior engineers gain access to <strong>AI-powered expert analysis</strong></li>
</ul>
<p><strong>Operational Benefits:</strong></p>
<ul>
<li>Network engineers focus on <strong>strategy, not tool-switching</strong></li>
<li><strong>Cross-functional collaboration</strong> in one platform</li>
<li><strong>Reduced tool sprawl</strong> and management overhead</li>
</ul>
<h2>Lessons Learned</h2>
<p>After building this lab, several key insights emerged regarding how network data fits into the broader observability ecosystem:</p>
<p><strong>1. Extending Observability to the Network</strong></p>
<p>Elastic is already the gold standard for high-volume logs and application traces. This lab demonstrates that the same engine seamlessly handles network telemetry without needing a separate, siloed tool.</p>
<ul>
<li>Scale: The same architecture that ingests petabytes of application logs easily handles millions of interface counters.</li>
<li>Structure: Native support for complex nested documents allows for rich SNMP trap data (variable bindings) without flattening or losing context.</li>
<li>Speed: Real-time search applies equally to network events, enabling sub-second troubleshooting.</li>
</ul>
<p><strong>2. OpenTelemetry Semantic Conventions (SemConv) as the Universal Translator</strong></p>
<p>The power isn't just in storing the data, but in standardizing it. By mapping SNMP and NetFlow to the <strong>OpenTelemetry Semantic Conventions (SemConv)</strong>, network data finally speaks the same language as the rest of the stack.</p>
<ul>
<li><strong>Unified Search:</strong> Query across firewall logs, server metrics, and switch telemetry in a single search bar.</li>
<li><strong>Instant Visualization:</strong> Pre-built dashboards work immediately because the field names are standardized.</li>
<li><strong>Cross-Domain Correlation</strong>: Easily correlates a spike in application latency with a specific interface saturation event.</li>
</ul>
<p><strong>3. AI Assistants Thrive on Context</strong></p>
<p>While the AI in this lab was powerful on its own, the experiment highlighted a critical realization: an AI Assistant becomes exponentially more effective when coupled with a specific Knowledge Base.</p>
<p><strong>Context is King:</strong> The AI delivers better root cause analysis when provided with rich metadata, such as device roles and topology maps. Without it, the advice remains generic.</p>
<p><strong>Pro Tip (and What’s Next):</strong></p>
<p>To get organization-specific advice rather than generic suggestions, you need to feed the AI your documentation.</p>
<ul>
<li><strong>The Goal:</strong> Create a Knowledge Base containing device roles, network topology diagrams, and troubleshooting procedures.</li>
<li><strong>The Next Step:</strong> In my next blog post, I will demonstrate exactly how to do this — connecting a Knowledge Base to the AI Assistant to enable fully context-aware troubleshooting.</li>
</ul>
<h2>Conclusion: Completing the Observability Picture</h2>
<p>Elastic is already widely recognized as the standard for Application and Security observability. The goal of this lab wasn't to ask if Elastic can handle networking, but to demonstrate the immense value of bringing network data into that existing ecosystem.</p>
<p>The verdict is clear: Elastic acts as that unified foundation. It effectively breaks down the silo between Network Engineering and the rest of IT.</p>
<p>This isn't just about consolidating dashboards or replacing legacy tools. It is about establishing the Elasticsearch AI Platform as the single source of truth where network telemetry sits right alongside application and infrastructure data.</p>
<p>By treating network data as a first-class citizen in the observability stack, we unlock automated correlation, AI-assisted investigation, and the speed required to resolve incidents before they impact the business. The capabilities are in place, and the foundation is solid — Elastic is ready to unify your network with the rest of your digital business.</p>
<h2>Ready to Try It Yourself?</h2>
<p>Check out <a href="https://github.com/DeBaker1974/Containerlab-OSPF">github.com/DeBaker1974/Containerlab-OSPF</a></p>
<p>The repository includes:</p>
<ul>
<li>Complete deployment scripts (12-15 minute automated setup)</li>
<li>Pre-configured telemetry pipelines</li>
<li>Kibana dashboards</li>
<li>Alert rules with AI Assistant integration</li>
<li>Detailed README</li>
</ul>
<p><strong>Not ready to build? Try Elastic Serverless:</strong> <a href="https://cloud.elastic.co/registration">Start a free 14-day trial</a> and explore AI-powered observability with your own data.</p>
<p><strong>Special thanks to the Containerlab and FRRouting communities for their incredible open-source tools, and to Sheriff Lawal (CCIE, CISSP), Sr. Manager, Solutions Architecture at Elastic, for mentoring on this project.</strong></p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/network-monitoring-with-elastic-unifying-network-observability/article-image.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[NGNIX log analytics with GenAI in Elastic]]></title>
            <link>https://www.elastic.co/observability-labs/blog/nginx-log-analytics-with-genai-elastic</link>
            <guid isPermaLink="false">nginx-log-analytics-with-genai-elastic</guid>
            <pubDate>Fri, 05 Jul 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[Elastic has a set of embedded capabilities such as a GenAI RAG-based AI Assistant and a machine learning platform as part of the product baseline. These make analyzing the vast number of logs you get from NGINX easier.]]></description>
            <content:encoded><![CDATA[<p>Elastic Observability provides a full observability solution, supporting metrics, traces, and logs for applications and infrastructure. NGINX, which is highly used for web serving, load balancing, http caching, and reverse proxy, is the key to many applications and outputs a large volume of logs. NGINX’s access logs, which detail all requests made to the NGINX server, and error logs which record server-related issues and problems are key to managing and analyzing NGINX issues along with understanding what is happening to your application. </p>
<p>In managing NGINX Elastic provides several capabilities:</p>
<ol>
<li>
<p>Easy ingest, parsing, and out-of-the-box dashboards. Check out the simple how-to in our <a href="https://www.elastic.co/guide/en/fleet/current/example-standalone-monitor-nginx.html">docs</a>. Based on logs, these dashboards show several items over time, response codes, errors, top pages, data volume, browsers used, active connections, drop rates, and much more.</p>
</li>
<li>
<p>Out-of-the-box ML-based anomaly detection jobs for your NGINX logs. These jobs help pinpoint anomalies against request rates, IP address request rates, URL access, status codes, and visitor rate anomalies.</p>
</li>
<li>
<p>ES|QL which helps work through logs and build out charts during analysis.</p>
</li>
<li>
<p>Elastic’s GenAI Assistant provides a simple natural language interface that helps analyze all the logs and can pull out issues from ML jobs and even create dashboards. The Elastic AI Assistant also automatically uses ES|QL.</p>
</li>
<li>
<p>NGINX SLOs - Finally Elastic provides the ability to define and monitor SLOs for your NGINX logs. While most SLOs are metrics-based, Elastic allows you to create logs-based SLOs. We detailed this in a previous <a href="https://www.elastic.co/observability-labs/blog/service-level-objectives-slos-logs-metrics">blog</a>.</p>
</li>
</ol>
<p>NGINX logs are another example of why logs are great.  Logging is an important part of Observability, for which we generally think of metrics and tracing. However, the amount of logs an application and the underlying infrastructure output can be significantly daunting and NGINX is usually the starting point for most analyses. </p>
<p>In today’s blog, we’ll cover how the out-of-the-box ML-based anomaly detection jobs can help RCA, and how Elastic’s GenAI Assistant helps easily work through logs to pinpoint issues in minutes. </p>
<h2>Prerequisites and config&lt;a id=&quot;prerequisites-and-config&quot;&gt;&lt;/a&gt;</h2>
<p>If you plan on following this blog, here are some of the components and details we used to set up this demonstration:</p>
<ul>
<li>
<p>Ensure you have an account on <a href="http://cloud.elastic.co">Elastic Cloud</a> and a deployed stack (<a href="https://www.elastic.co/guide/en/elastic-stack/current/installing-elastic-stack.html">see instructions here</a>).</p>
</li>
<li>
<p>Bring up an <a href="https://docs.nginx.com/nginx/admin-guide/web-server/">NGINX server</a> on a host. OR run an application with NGINX as a front end and drive traffic.</p>
</li>
<li>
<p>Install the NGINX integration and assets and review the dashboards as noted in the <a href="https://www.elastic.co/guide/en/fleet/current/example-standalone-monitor-nginx.html">docs</a>.</p>
</li>
<li>
<p>Ensure you have an <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-settings.html">ML node configured</a> in your Elastic stack</p>
</li>
<li>
<p>To use the AI Assistant you will need a trial or upgrade to Platinum.</p>
</li>
</ul>
<p>In our scenario, we use data from 3 months from our Elastic environment to help highlight the features. Hence you might need to run your application with traffic for a specific time frame to follow along.</p>
<h2>Analyzing the issues with AI Assistant&lt;a id=&quot;analyzing-the-issues-with-ai-assistant&quot;&gt;&lt;/a&gt;</h2>
<p>As detailed in a previous <a href="https://www.elastic.co/observability-labs/blog/service-level-objectives-slos-logs-metrics">blog</a>, you can get alerted on issues via SLO monitoring against NGINX logs. Let’s assume you have an SLO based on status codes as we outlined in the previous <a href="https://www.elastic.co/observability-labs/blog/service-level-objectives-slos-logs-metrics">blog</a>. You can immediately analyze the issue via the AI Assistant. Because it's a chat interface we simply open the AI Assistant and work through some simple analysis: (See Animated GIF for a demo)</p>
<h3>AI Assistant analysis:&lt;a id=&quot;ai-assistant-analysis&quot;&gt;&lt;/a&gt;</h3>
<ul>
<li>
<p><strong><em>Using lens graph all http response status codes &lt; 400 and &gt; =400 from filebeat-nginx-elasticco-anon-2017. http.response.status.code is not an integer</em></strong> <em>-</em> We wanted to simply understand the amount of requests resulting in status code &gt;= 400 and graph the results. We see that 15% of the requests were not successful, hence an SLO alert being triggered.</p>
</li>
<li>
<p><strong>Which ip address (field source.adress) has the highest number of http.response.status.code &gt;= 400 from filebeat-nginx-elasticco-anon-2017. http.response.status.code is not an integer</strong>  - We were curious is there was a specific IP address not having successful requests. 72.57.0.53, with a count of 25,227 occurrences is daily high but not the ensure 2 failed requests.</p>
</li>
<li>
<p><strong><em>What country (source.geo.country_iso_code) is source.address=72.57.0.53 coming from. Use filebeat-nginx-elasticco-anon-2017.</em></strong> - Again we were curious if this came from a specific country. And the IP address 72.57.0.53 is coming from the country with the ISO code IN, which corresponds to India. Nothing out of the ordinary.</p>
</li>
<li>
<p><strong><em>Did source.address=72.57.0.53 have any (http.response.status.code &lt; 400) from filebeat-nginx-elasticco-anon-2017. http.response.status.code is not an integer -</em></strong>  Oddly the IP address in question only had 4000+ successful responses. Meaning its not malicious, and points to something else.</p>
</li>
<li>
<p><strong><em>What are the different status codes (http.response.status.code&gt;=400), from source.address=72.57.0.53. Use filebeat-nginx-elasticco-anon-2017. http.response.status.code is not an integer. Provide counts for each status code -</em></strong> We are curious whether or not we see any 502, which there were none, but most of the failures were 404. </p>
</li>
<li>
<p><strong><em>What are the different status codes (http.response.status.code&gt;=400). Use filebeat-nginx-elasticco-anon-2017. http.response.status.code is not an integer. Provide counts for each status code</em></strong> - Regardless of a specific address, what is the largest number of status code occurrences &gt; 400. This also points to 404. </p>
</li>
<li>
<p><strong><em>What does a high 404 count from a specific IP address mean from NGINX logs?</em></strong> - Asking this question, we need to understand the potential causes of this from our application. From the answers, we can rule out security probing and web scraping, as we validated that a specific address 72.57.0.53 has a low non-success request status code. It also rules out User error. Hence this points potentially to Broken Links or Missing Resources.</p>
</li>
</ul>
<h3>Watch the flow:&lt;a id=&quot;watch-the-flow&quot;&gt;&lt;/a&gt;</h3>
&lt;Video vidyardUuid=&quot;ak9xDdhcL3SxpqU7CRsD68&quot; /&gt;
<h3>Potential issue:</h3>
<p>It seems that we potentially have an issue with the backend serving specific answers or having issues with resources (database, or broken links). This is cursing the higher-than-normal non-successful status codes&gt;=400.</p>
<h3>Key highlights from AI Assistant:</h3>
<p>As you watched this video you will notice a few things:</p>
<ol>
<li>
<p>We analyzed millions of logs in a matter of minutes using a set of simple natural language queries. </p>
</li>
<li>
<p>We didn’t need to know any special query language. The AI Assistant used Elastic’s ES|QL but can similarly use KQL also. </p>
</li>
<li>
<p>The AI Assistant easily builds out graphs</p>
</li>
<li>
<p>The AI Assistant is accessing and using internal information stored in Elastic’s indices. Vs a simple “google foo” based AI Assistant. This is enabled through RAG, and the AI Assistant can also bring up known issues in github, runbooks, and other useful internal information.</p>
</li>
</ol>
<p>Check out the following <a href="https://www.elastic.co/observability-labs/blog/elastic-rag-ai-assistant-application-issues-llm-github">blog</a> on how the AI Assistant uses RAG to retrieve internal information. Specifically using github and runbooks.</p>
<h2>Locating anomalies with ML</h2>
<p>While using the AI Assistant is great for analyzing information, another important aspect of NGINX log management is to ensure you can manage log spikes and anomalies. Elastic has a machine learning platform that allows you to develop jobs to analyze specific metrics or multiple metrics to look for anomalies.When using NGINX, there are several <a href="https://www.elastic.co/guide/en/machine-learning/current/ootb-ml-jobs-nginx.html">out-of-the-box anomaly detection jobs</a>. These work specifically on NGINX access logs.</p>
<ul>
<li>
<p>Low_request_rate_nginx - Detect low request rates</p>
</li>
<li>
<p>Source_ip_request_rate_nginx - Detect unusual source IPs - high request rates</p>
</li>
<li>
<p>Source_ip_url_count_nginx - Detect unusual source IPs - high distinct count of URLs</p>
</li>
<li>
<p>Status_code_rate_nginx - Detect unusual status code rates</p>
</li>
<li>
<p>Visitor_rate_nginx - Detect unusual visitor rates</p>
</li>
</ul>
<p>Being right out of the box, lets look at the job - Status_code_rate_nginx, which is related to our previous analysis.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/nginx-log-analytics-with-genai-elastic/nginx-ml-log-analytics.png" alt="NGINX ML Log Analytics" /></p>
<p>With a few simple clicks we immediately get an analysis showing a specific IP address - 72.57.0.53, having higher than normal non-successful requests. Oddly we also found this is using the AI Assistant.</p>
<p>We can take this further with conversations with the AI Assistant, look at the logs, and/or even look at the other ML anomaly jobs.</p>
<h2>Conclusion:&lt;a id=&quot;conclusion&quot;&gt;&lt;/a&gt;</h2>
<p>You’ve now seen how easily Elastic’s RAG-based AI Assistant can help analyze NGINX logs without even the need to know query syntax, understand where the data is, and understand even the fields. Additionally, you’ve also seen how we can alert you when a potential issue or degradation in service (SLO). </p>
<p>Check out other resources on NGINX logs:</p>
<p><a href="https://www.elastic.co/guide/en/machine-learning/current/ootb-ml-jobs-nginx.html">Out-of-the-box anomaly detection jobs for NGINX</a></p>
<p><a href="https://www.elastic.co/guide/en/fleet/current/example-standalone-monitor-nginx.html">Using the NGINX integration to ingest and analyze NGINX Logs</a></p>
<p><a href="https://www.elastic.co/observability-labs/blog/service-level-objectives-slos-logs-metrics">NGINX Logs based SLOs in Elastic</a></p>
<p><a href="https://www.elastic.co/observability-labs/blog/elastic-rag-ai-assistant-application-issues-llm-github">Using GitHub issues, runbooks, and other internal information for RCAs with Elastic’s RAG based AI Assistant</a></p>
<h2>Try it out&lt;a id=&quot;try-it-out&quot;&gt;&lt;/a&gt;</h2>
<p>Existing Elastic Cloud customers can access many of these features directly from the <a href="https://cloud.elastic.co/">Elastic Cloud console</a>. Not taking advantage of Elastic on the cloud? <a href="https://www.elastic.co/cloud/cloud-trial-overview">Start a free trial</a>.</p>
<p>All of this is also possible in your environment. <a href="https://www.elastic.co/observability/universal-profiling">Learn how to get started today</a>.</p>
<p><em>The release and timing of any features or functionality described in this post remain at Elastic's sole discretion. Any features or functionality not currently available may not be delivered on time or at all.</em></p>
<p><em>In this blog post, we may have used or referred to third party generative AI tools, which are owned and operated by their respective owners. Elastic does not have any control over the third party tools and we have no responsibility or liability for their content, operation or use, nor for any loss or damage that may arise from your use of such tools. Please exercise caution when using AI tools with personal, sensitive or confidential information. Any data you submit may be used for AI training or other purposes. There is no guarantee that information you provide will be kept secure or confidential. You should familiarize yourself with the privacy practices and terms of use of any generative AI tools prior to use.</em></p>
<p><em>Elastic, Elasticsearch, ESRE, Elasticsearch Relevance Engine and associated marks are trademarks, logos or registered trademarks of Elasticsearch N.V. in the United States and other countries. All other company and product names are trademarks, logos or registered trademarks of their respective owners.</em></p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/nginx-log-analytics-with-genai-elastic/blog-thumb-observability-pattern-color.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[Optimizing Observability with ES|QL: Streamlining SRE operations and issue resolution for Kubernetes and OTel]]></title>
            <link>https://www.elastic.co/observability-labs/blog/opentelemetry-kubernetes-esql</link>
            <guid isPermaLink="false">opentelemetry-kubernetes-esql</guid>
            <pubDate>Wed, 01 Nov 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[ES|QL enhances operational efficiency, data analysis, and issue resolution for SREs. This blog covers the advantages of ES|QL in Elastic Observability and how it can apply to managing issues instrumented with OpenTelemetry and running on Kubernetes.]]></description>
            <content:encoded><![CDATA[<p>As an operations engineer (SRE, IT Operations, DevOps), managing technology and data sprawl is an ongoing challenge. Simply managing the large volumes of high dimensionality and high cardinality data is overwhelming.</p>
<p>As a single platform, Elastic® helps SREs unify and correlate limitless telemetry data, including metrics, logs, traces, and profiling, into a single datastore — Elasticsearch®. By then applying the power of Elastic’s advanced machine learning (ML), AIOps, AI Assistant, and analytics, you can break down silos and turn data into insights. As a full-stack observability solution, everything from infrastructure monitoring to log monitoring and application performance monitoring (APM) can be found in a single, unified experience.</p>
<p>In Elastic 8.11, a technical preview is now available of <a href="https://www.elastic.co/blog/esql-elasticsearch-piped-query-language">Elastic’s new piped query language, ES|QL (Elasticsearch Query Language)</a>, which transforms, enriches, and simplifies data investigations. Powered by a new query engine, ES|QL delivers advanced search capabilities with concurrent processing, improving speed and efficiency, irrespective of data source and structure. Accelerate resolution by creating aggregations and visualizations from one screen, delivering an iterative, uninterrupted workflow.</p>
<h2>Advantages of ES|QL for SREs</h2>
<p>SREs using Elastic Observability can leverage ES|QL to analyze logs, metrics, traces, and profiling data, enabling them to pinpoint performance bottlenecks and system issues with a single query. SREs gain the following advantages when managing high dimensionality and high cardinality data with ES|QL in Elastic Observability:</p>
<ul>
<li><strong>Improved operational efficiency:</strong> By using ES|QL, SREs can create more actionable notifications with aggregated values as thresholds from a single query, which can also be managed through the Elastic API and integrated into DevOps processes.</li>
<li><strong>Enhanced analysis with insights:</strong> ES|QL can process diverse observability data, including application, infrastructure, business data, and more, regardless of the source and structure. ES|QL can easily enrich the data with additional fields and context, allowing the creation of visualizations for dashboards or issue analysis with a single query.</li>
<li><strong>Reduced mean time to resolution:</strong> ES|QL, when combined with Elastic Observability's AIOps and AI Assistant, enhances detection accuracy by identifying trends, isolating incidents, and reducing false positives. This improvement in context facilitates troubleshooting and the quick pinpointing and resolution of issues.</li>
</ul>
<p>ES|QL in Elastic Observability not only enhances an SRE's ability to manage the customer experience, an organization's revenue, and SLOs more effectively but also facilitates collaboration with developers and DevOps by providing contextualized aggregated data.</p>
<p>In this blog, we will cover some of the key use cases SREs can leverage with ES|QL:</p>
<ul>
<li>ES|QL integrated with the Elastic AI Assistant, which uses public LLM and private data, enhances the analysis experience anywhere in Elastic Observability.</li>
<li>SREs can, in a single ES|QL query, break down, analyze, and visualize observability data from multiple sources and across any time frame.</li>
<li>Actionable alerts can be easily created from a single ES|QL query, enhancing operations.</li>
</ul>
<p>I will work through these use cases by showcasing how an SRE can solve a problem in an application instrumented with OpenTelemetry and running on Kubernetes. The OpenTelemetry (OTel) demo is on an Amazon EKS cluster, with Elastic Cloud 8.11 configured.</p>
<p>You can also check out our <a href="https://www.youtube.com/watch?v=vm0pBWI2l9c">Elastic Observability ES|QL Demo</a>, which walks through ES|QL functionality for Observability.</p>
<h2>ES|QL with AI Assistant</h2>
<p>As an SRE, you are monitoring your OTel instrumented application with Elastic Observability, and while in Elastic APM, you notice some issues highlighted in the service map.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/opentelemetry-kubernetes-esql/elastic-blog-1-services.png" alt="1 - services" /></p>
<p>Using Elastic AI Assistant, you can easily ask for analysis, and in particular, we check on what the overall latency is across the application services.</p>
<pre><code class="language-plaintext">My APM data is in traces-apm*. What's the average latency per service over the last hour? Use ESQL, the data is mapped to ECS
</code></pre>
&lt;Video vidyardUuid=&quot;wHJpzouDQHB51UftmkHFyo&quot; /&gt;
<p>The Elastic AI Assistant generates an ES|QL query, which we run in the AI Assistant to get a list of the average latencies across all the application services. We can easily see the top four are:</p>
<ul>
<li>load generator</li>
<li>front-end proxy</li>
<li>frontendservice</li>
<li>checkoutservice</li>
</ul>
<p>With a simple natural language query in the AI Assistant, it generated a single ES|QL query that helped list out the latencies across the services.</p>
<p>Noticing that there is an issue with several services, we decide to start with the frontend proxy. As we work through the details, we see significant failures, and through <strong>Elastic APM failure correlation</strong> , it becomes apparent that the frontend proxy is not properly completing its calls to downstream services.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/opentelemetry-kubernetes-esql/elastic-blog-2-failed-transaction.png" alt="2 - failed transaction" /></p>
<h2>ES|QL insightful and contextual analysis in Discover</h2>
<p>Knowing that the application is running on Kubernetes, we investigate if there are issues in Kubernetes. In particular, we want to see if there are any services having issues.</p>
<p>We use the following query in ES|QL in Elastic Discover:</p>
<pre><code class="language-sql">from metrics-* | where kubernetes.container.status.last_terminated_reason != &quot;&quot; and kubernetes.namespace == &quot;default&quot; | stats reason_count=count(kubernetes.container.status.last_terminated_reason) by kubernetes.container.name, kubernetes.container.status.last_terminated_reason | where reason_count &gt; 0
</code></pre>
<p><img src="https://www.elastic.co/observability-labs/assets/images/opentelemetry-kubernetes-esql/elastic-blog-3-two-horizontal-bar-graphs.png" alt="3 - horizontal graph" /></p>
<p>ES|QL helps analyze 1,000s/10,000s of metric events from Kubernetes and highlights two services that are restarting due to OOMKilled.</p>
<p>The Elastic AI Assistant, when asked about OOMKilled, indicates that a container in a pod was killed due to an out-of-memory condition.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/opentelemetry-kubernetes-esql/elastic-blog-4-understanding-oomkilled.png" alt="4 - understanding oomkilled" /></p>
<p>We run another ES|QL query to understand the memory usage for emailservice and productcatalogservice.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/opentelemetry-kubernetes-esql/elastic-blog-5-split-bar-graphs.png" alt="5 - split bar graphs" /></p>
<p>ES|QL easily found the average memory usage fairly high.</p>
<p>We can now further investigate both of these services’ logs, metrics, and Kubernetes-related data. However, before we continue, we create an alert to track heavy memory usage.</p>
<h2>Actionable alerts with ES|QL</h2>
<p>Suspecting a specific issue, that might recur, we simply create an alert that brings in the ES|QL query we just ran that will track for any service that exceeds 50% in memory utilization.</p>
<p>We modify the last query to find any service with high memory usage:</p>
<pre><code class="language-sql">FROM metrics*
| WHERE @timestamp &gt;= NOW() - 1 hours
| STATS avg_memory_usage = AVG(kubernetes.pod.memory.usage.limit.pct) BY kubernetes.deployment.name | where avg_memory_usage &gt; .5
</code></pre>
<p>With that query, we create a simple alert. Notice how the ES|QL query is brought into the alert. We simply connect this to pager duty. But we can choose from multiple connectors like ServiceNow, Opsgenie, email, etc.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/opentelemetry-kubernetes-esql/elastic-blog-6-create-rule.png" alt="6 - create rule" /></p>
<p>With this alert, we can now easily monitor for any services that exceed 50% memory utilization in their pods.</p>
<h2>Make the most of your data with ES|QL</h2>
<p>In this post, we demonstrated the power ES|QL brings to analysis, operations, and reducing MTTR. In summary, the three use cases with ES|QL in Elastic Observability are as follows:</p>
<ul>
<li>ES|QL integrated with the Elastic AI Assistant, which uses public LLM and private data, enhances the analysis experience anywhere in Elastic Observability.</li>
<li>SREs can, in a single ES|QL query, break down, analyze, and visualize observability data from multiple sources and across any time frame.</li>
<li>Actionable alerts can be easily created from a single ES|QL query, enhancing operations.</li>
</ul>
<p>Elastic invites SREs and developers to experience this transformative language firsthand and unlock new horizons in their data tasks. Try it today at <a href="https://ela.st/free-trial">https://ela.st/free-trial</a> now in technical preview.</p>
<blockquote>
<ul>
<li><a href="https://www.elastic.co/demo-gallery/observability">Elastic Observability Tour</a></li>
<li><a href="https://www.elastic.co/blog/log-management-observability-operations">The power of effective log management</a></li>
<li><a href="https://www.elastic.co/blog/context-aware-insights-elastic-ai-assistant-observability">Transforming Observability with the AI Assistant</a></li>
<li><a href="https://www.elastic.co/blog/esql-elasticsearch-piped-query-language">ES|QL announcement blog</a></li>
</ul>
</blockquote>
<p><em>The release and timing of any features or functionality described in this post remain at Elastic's sole discretion. Any features or functionality not currently available may not be delivered on time or at all.</em></p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/opentelemetry-kubernetes-esql/ES_QL_blog-720x420-05.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[Live logs and prosper: fixing a fundamental flaw in observability]]></title>
            <link>https://www.elastic.co/observability-labs/blog/reimagine-observability-elastic-streams</link>
            <guid isPermaLink="false">reimagine-observability-elastic-streams</guid>
            <pubDate>Mon, 27 Oct 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[Stop chasing symptoms. Learn how Streams, in Elastic Observability fixes the fundamental flaw in observability, using AI to proactively find the 'why' in your logs for faster resolution.]]></description>
            <content:encoded><![CDATA[<p>SREs are often overwhelmed by dashboards and alerts that show what and where things are broken, but fail to reveal why. This industry-wide focus on visualizing symptoms forces engineers to manually hunt for answers. The crucial &quot;why&quot; is buried in information-rich logs, but their massive volume and unstructured nature has led the industry to throw them aside or treat them like a second-class citizen. As a result, SREs are forced to turn every investigation into a high-stress, time-consuming hunt for clues. We can solve this problem with logs, but unlocking their potential requires us to reimagine how we work with them and improve the overall investigations journey.</p>
<h2>Observability, the broken promise</h2>
<p>To see why the current model fails, let’s look at the all-too-familiar challenge every SRE dreads: knowing a problem exists but needing to spend valuable time just trying to find where to even start the investigation.</p>
<p>Imagine you get a Slack message from the support team: &quot;a few high-value customers are reporting their payments are failing.&quot; You have no shortage of alerts, but most are just flagging symptoms. You don’t know where to start. You decide to check the logs to see if there is anything obvious, starting with the systems that have the high CPU alert.</p>
<p>You spend a few minutes searching and <code>grep</code>-ing through terabytes of logs for affected customer IDs, trying to piece together the problem. Nothing. You worry that you aren’t getting all the logs to reveal the problem, so you turn on more logging in the application. Now you’re knee-deep in data, desperately trying to find patterns, errors, or other &quot;hints&quot; that will give you a clue as to the <em>why</em>.</p>
<p>Finally, one of the broader log queries hits on an error code associated with an impacted customer ID. This is the first real clue. You pivot your search to this new error code and after an hour of digging, you finally uncover the error message. You've finally found the <em>why</em>, but it was a stressful, manual hunt that took far too much time and impacted dozens more customers.</p>
<p>This incident perfectly illustrates the broken promise of modern observability: The complete failure of the investigation process. Investigations are a manual, reactive process that SREs are forced into every day. At Elastic, we believe metrics, traces, and logs are all essential, but their roles, and the workflow between them, must be fundamentally re-imagined for effective investigations.</p>
<p>Observability is about having the clearest understanding possible of the <em>what</em>, <em>where</em>, and <em>why</em>. Metrics are essential for understanding the <em>what</em>. They are the heartbeat of your system, powering the dashboards and alerts that tell you when a threshold has been breached, like high CPU utilization or error rates. But they are aggregates; they show the symptom, rarely the root cause. Traces are good at identifying the <em>where</em>. They map the journey of a request through a distributed system, pinpointing the specific microservice or function where latency spikes or an error originates. Yet, their effectiveness hinges on complete and consistent code instrumentation, a constant dependency on development teams that can leave you with critical visibility gaps. Logs tell you the <em>why</em>. They contain all the rich, contextual, and unfiltered truth of an event. If we can more proactively and efficiently extract information from logs, we can greatly improve our overall understanding of our environments.</p>
<h2>Challenges of logs in modern environments</h2>
<p>While logs are in the standard toolbox, they have been neglected. SREs using today’s solutions deal with several major problems:</p>
<ul>
<li>First, due to their unstructured nature, it’s very difficult to parse and manage logs so that they’re useful. As a result, many SRE teams spend a lot of time building and maintaining complex pipelines to help manage this process. </li>
</ul>
<ul>
<li>Second, logs can get expensive at high volume, which leads teams to drop them on the floor to control costs, throwing away valuable information in the process. Consequently, when an incident occurs, you waste precious time hunting for the right logs, and manually correlating across services.</li>
</ul>
<ul>
<li>Finally, nobody has built a log solution that proactively works to find the important signals in logs and to surface those critical <em>whys</em> to you when you need them. As a result, log-based investigations are too painful and slow.</li>
</ul>
<p>Why are we here? As applications became more complex, log volume became unmanageable. Instead of solving this with automation, the industry took a shortcut: it gave up on getting the most out of logs and prioritized more manageable but less informative signals.</p>
<p>This decision is the origin of the broken, reactive model. It forced observability into a manual loop of 'observing' alerts, rather than building automation that could help us truly understand our systems to improve how we root cause and resolve issues. This has transformed SREs from investigators into full-time data wranglers, wrestling with Grok patterns and fragile ETL scripts instead of solving outages. </p>
<h2>Introducing Streams to rethink how you use logs for investigations</h2>
<p>Streams is an agentic AI solution that simplifies working with logs to help SRE teams rapidly understand the <em>why</em> behind an issue for faster resolution. The combination of Elasticsearch and AI is turning manual management of noisy logs into automated workflows that identify patterns, context, and meaning, marking a fundamental shift in observability.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/reimagine-observability-elastic-streams/streams-manifesto-01.png" alt="Streams" /></p>
<h4>Log everything in any format</h4>
<p>By applying the Elasticsearch platform for context engineering to bring together retrieval and AI-driven parsing to keep up with schema changes, we are reimagining the entire log pipeline.  </p>
<p>Streams ingests raw logs from all your sources to a single destination. It then uses AI to partition incoming logs into their logical components and parses them to extract relevant fields for an SRE to validate, approve, or modify. Imagine a world where you simply point your logs to a single endpoint, and everything just works. Less wrestling with Grok patterns, configuring processors, and hunting for the right plugin. All of which significantly reduces the complexity. Streams is a big step towards realizing that vision.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/reimagine-observability-elastic-streams/streams-manifesto-02.png" alt="Streams" /></p>
<p>As a result, SREs are freed from managing complex ingestion pipelines, allowing them to spend less time on data wrangling and more time preventing service disruptions.</p>
<h4>Solve incidents faster with Significant Events </h4>
<p>Significant Events, a capability within Streams, uses AI to automatically surface major errors and anomalies, enabling you to be proactive in your investigations. So, instead of just combing through endless noise, you can focus on the events that truly matter, such as startup and shutdown messages, out-of-memory errors, internal server failures, and other significant signals of change. These events act as actionable markers, giving SREs early warning and clear focus to begin an investigation before service impact.</p>
<p>With this new foundation, logs will become your primary signal for investigation. The panicked, manual search for a needle in a digital haystack is about to be over. Significant Events acts like a smart metal detector that sifts through the chaos and only beeps when it finds issues, helping you to easily ignore all that hay and find the &quot;needle&quot; faster. </p>
<p>Now imagine the same scenario we started with. Instead of starting a frantic, time-consuming grep through terabytes of logs. Streams has already done the heavy lifting. Its AI-driven analysis has detected a new, anomalous pattern that began before your support team even knew about it and automatically surfaced it as a significant event. Rather than you hunting for a clue, the clue finds you. </p>
<p>With a single click, you have the <em>why</em>: a Java out-of-memory error in a specific service component. This is your starting point. You find the root cause in under two minutes and begin remediation. The customer impact is stopped, the dev team gets the specific error, and the problem is contained before it can escalate. In this case, metrics and traces were unhelpful in finding the <em>why</em>. The answer was waiting in the logs all along.</p>
<p>This ideal outcome is possible because you can both afford to keep every log and instantly find the signal within them. Elastic's cost-efficient architecture with powerful compression, searchable snapshots, and data tiering makes full retention a reality. From there, Streams automatically surfaces the significant event, ensuring that the answer is never lost in the noise.</p>
<p>Elastic is the only company that provides an AI-driven log-first approach to elevate your observability signals and make it dramatically faster and easier to get to <em>why</em>. This is built on our decades of leadership in search, relevance, and powerful analytics that provides the foundation for understanding logs at a deep, semantic level.</p>
<h2>The vision for Streams </h2>
<p>The partitioning, parsing, and Significant Events you see today is just the starting point. The next step in our vision is to use the Significant Events to automatically generate critical SRE artifacts. Imagine Streams creating intelligent alerts, on-the-fly investigation dashboards, and even data-driven SLOs based <em>only</em> on the events that actually impact service health. From there, the goal is to use AI to drive automated Root Cause Analysis (RCA) directly from log patterns and generate remediation runbooks, turning a multi-hour hunt into an instant resolution recommendation.</p>
<p>Once this AI-drive log foundation is in place, our vision for Streams expands to become a unified intelligence layer that operates across all your telemetry data. It’s not just about making each signal better in isolation, but about understanding the context and relationships between them to solve complex problems. </p>
<p>For metrics, Streams won’t just alert you to a single metric spike but detect a correlated anomaly across multiple, seemingly unrelated metrics e.g. p99 latency for a specific service, rise in garbage collection time, transaction success rate.</p>
<p>Similarly, for traces it identifies a new, unexpected service call (e.g., a new database or an external API) appears in a critical transaction path after a deployment or identifies specific span is suddenly responsible for a majority of errors across all traces, even if the overall error rate hasn't breached a threshold.</p>
<p>The goal is not to have separate streams for logs, metrics, and traces, but to weave them into a single narrative that automatically correlates all three signals. Ultimately, Streams is about fundamentally changing the goal from human led data gathering exercise to proactive, AI-driven resolution.</p>
<p><em>For more on Streams:</em></p>
<p><em>Read the</em> <a href="https://www.elastic.co/observability-labs/blog/elastic-observability-streams-ai-logs-investigations"><em>Streams launch blog</em></a></p>
<p><em>Look at the</em> <a href="http://elastic.co/elasticsearch/streams"><em>Streams website</em></a></p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/reimagine-observability-elastic-streams/streams-manifesto.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[How Streams in Elastic Observability Simplifies Retention Management]]></title>
            <link>https://www.elastic.co/observability-labs/blog/simplifying-retention-management-with-streams</link>
            <guid isPermaLink="false">simplifying-retention-management-with-streams</guid>
            <pubDate>Thu, 30 Oct 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[Learn how Streams simplifies retention management in Elasticsearch with a unified view to monitor, visualize, and control data lifecycles using DSL or ILM.]]></description>
            <content:encoded><![CDATA[<p>Managing retention in Elasticsearch can get complicated fast. Between <a href="https://www.elastic.co/docs/manage-data/lifecycle/data-stream">Data stream lifecycle (DSL)</a>, <a href="https://www.elastic.co/docs/manage-data/lifecycle/index-lifecycle-management">Index lifecycle management (ILM)</a>, templates, and individual index settings, keeping policies consistent across data streams often takes more effort than it should.</p>
<p><strong>Streams</strong> changes that. It introduces a clear, unified way to manage how long your data lives, whether you’re using DSL or ILM. You can visualize ingestion, understand where data sits across tiers, and adjust retention with confidence, applying updates to a single stream without worrying about unintended changes elsewhere, all from a single view.</p>
<h3>Walkthrough: Exploring the Retention Tab</h3>
<p><img src="https://www.elastic.co/observability-labs/assets/images/simplifying-retention-management-with-streams/retention_view.png" alt="Retention view of a stream" /></p>
<p>Retention management lives in the <strong>Retention</strong> tab of each stream. This is your control panel for understanding how much data you’re storing, how quickly it’s growing, and how your lifecycle policies are applied. It’s also where you can monitor and configure the <a href="https://www.elastic.co/docs/manage-data/data-store/data-streams/failure-store">Failure store</a>, which tracks and retains documents that failed to be ingested.</p>
<h4>Metrics at a glance</h4>
<p>At the top of the view, you’ll find an overview of key metrics:</p>
<ul>
<li>Storage size: the total data volume currently held by the stream.</li>
<li>Ingestion averages: calculated from the selected time range, Streams extrapolates both daily and monthly averages to give you a sense of long-term trends.</li>
</ul>
<p>This combination of near-real-time and projected values helps you quickly spot when ingestion is ramping up and whether your retention policy aligns with it.</p>
<h4>Ingestion over time</h4>
<p>Below the metrics, a graph shows ingestion volume over time. This information is approximated based on the number of documents over time, multiplied by the average document size in the backing index. </p>
<h4>Visualizing lifecycle phases</h4>
<p>When an ILM policy is effective, the retention view becomes more visual. Streams displays a phase breakdown (hot, warm, cold, frozen) showing the data volume stored in each phase. This gives you a clear sense of how your data is distributed across the storage tiers and whether your lifecycle is doing what you expect.</p>
<h4>Failure store</h4>
<p>A failure store is a secondary set of indices inside a data stream, dedicated to storing documents that failed to be ingested. Within the Retention tab, you can toggle the Failure store on or off, and configure its own retention period.
We’ll cover Failure store and Data quality in more detail in <a href="https://www.elastic.co/observability-labs/blog/data-quality-and-failure-store-in-streams">this article</a>.</p>
<h3>Updating Retention</h3>
<p>Beyond visualizing your retention, Streams makes it easy to change how it’s managed.</p>
<h4>Switching between DSL and ILM</h4>
<p>You can freely switch a stream between DSL and ILM management, or update a DSL retention  with just a few clicks. Streams takes care of updating the lifecycle settings at the data stream level, ensuring consistent retention across all existing backing indices, not just new ones.</p>
<p>Whether you prefer the simplicity of DSL or the fine-grained tiering of ILM, you can move between the two seamlessly.</p>
<p><em>Clicking “Edit data retention” opens a modal that allows you to update the stream’s configuration. From there you can update the ILM policy or set a custom retention period via DSL.</em>
<img src="https://www.elastic.co/observability-labs/assets/images/simplifying-retention-management-with-streams/edit_ilm.png" alt="Modal view to set a lifecycle policy" /></p>
<p><em>You can set a custom period, or pick an Indefinite retention for your data.</em>
<img src="https://www.elastic.co/observability-labs/assets/images/simplifying-retention-management-with-streams/edit_dsl.png" alt="Modal view to set a custom retention period" /></p>
<p><em>You can also update streams’ lifecycle via the <a href="https://www.elastic.co/docs/api/doc/kibana/operation/operation-put-streams-name">Upsert stream</a> or the <a href="https://www.elastic.co/docs/api/doc/kibana/operation/operation-put-streams-name-ingest">Update ingest stream settings</a> Kibana APIs.</em></p>
<h4>Inherit or defer: different strategies for different stream types</h4>
<p><strong>Classic streams</strong></p>
<p>For classic streams, you can default to the existing index template’s retention. Retention isn’t managed by Streams in this case, it follows the lifecycle configuration defined in the template just as it normally would.</p>
<p>This option is useful if you’re onboarding existing data streams and want to keep their lifecycle behavior intact while still benefiting from Streams’ visibility and monitoring features.</p>
<p><strong>Wired streams</strong></p>
<p>Wired streams live in a tree structure, and that hierarchy allows an inheritance model.</p>
<p>A child stream can inherit the lifecycle of its nearest ancestor that has a concrete policy (ILM or DSL). This keeps your configuration lean and consistent since you can set a single lifecycle at a higher level in the tree and let Streams automatically apply it to all relevant descendants.</p>
<p>If that ancestor’s lifecycle is later updated, Streams cascades the change down to all children that inherit it, so everything stays in sync.</p>
<p><em>In the figure below, we set a different retention for</em> <strong><em>logs.prod</em></strong> <em>and</em> <strong><em>logs.staging</em></strong> <em>environments. The child partitions of these environments automatically inherit the configuration.</em>
<img src="https://www.elastic.co/observability-labs/assets/images/simplifying-retention-management-with-streams/streams_tree.png" alt="A streams tree that shows inheritance" /></p>
<h4>How it works under the hood</h4>
<p>When you apply or update a lifecycle, <strong>Streams</strong> calls Elasticsearch’s <a href="https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-data-stream-settings">/_data_stream/_settings</a>. This is a new API we’ve added in 8.19 / 9.1 for this purpose. </p>
<p>This API is key to keeping retention consistent:</p>
<ol>
<li>It applies the lifecycle directly at the data stream level, overriding any configuration from cluster settings or index templates.</li>
<li>It propagates the retention update to all existing backing indices, not just new ones, so retention remains uniform across your historical and future data.</li>
</ol>
<p>By centralizing lifecycle management at the data stream level and applying a consistent configuration across the backing indices, we remove the ambiguity that used to exist between template-level and index-level configurations. You always know which retention policy is actually in effect, and you can see it directly in the UI.</p>
<h3>Wrapping Up</h3>
<p>With Streams, retention management becomes clear and consistent. You can visualize ingestion, switch between DSL and ILM, or inherit policies across streams, all without diving into templates or manual index settings.</p>
<p>By unifying retention into a single view, Streams turns lifecycle management into something simple, predictable, and transparent.</p>
<p>Sign up for an Elastic trial at <a href="http://cloud.elastic.co">cloud.elastic.co</a>, and trial Elastic's Serverless offering which will allow you to play with all of the Streams functionality.</p>
<p>Additionally, check out:</p>
<p><em>Read about</em> <a href="https://www.elastic.co/observability-labs/blog/reimagine-observability-elastic-streams"><em>Reimagining streams</em></a></p>
<p><em>Look at the</em> <a href="http://elastic.co/elasticsearch/streams"><em>Streams website</em></a></p>
<p><em>Read the</em> <a href="https://www.elastic.co/docs/solutions/observability/streams/streams"><em>Streams documentation</em></a></p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/simplifying-retention-management-with-streams/article.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[Enhancing SRE troubleshooting with the AI Assistant for Observability and your organization's runbooks]]></title>
            <link>https://www.elastic.co/observability-labs/blog/sre-troubleshooting-ai-assistant-observability-runbooks</link>
            <guid isPermaLink="false">sre-troubleshooting-ai-assistant-observability-runbooks</guid>
            <pubDate>Wed, 08 Nov 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[Empower your SRE team with this guide to enriching Elastic's AI Assistant Knowledge Base with your organization's internal observability information for enhanced alert remediation and incident management.]]></description>
            <content:encoded><![CDATA[<p>The <a href="https://www.elastic.co/blog/context-aware-insights-elastic-ai-assistant-observability">Observability AI Assistant</a> helps users explore and analyze observability data using a natural language interface, by leveraging automatic function calling to request, analyze, and visualize your data to transform it into actionable observability. The Assistant can also set up a Knowledge Base, powered by <a href="https://www.elastic.co/guide/en/machine-learning/current/ml-nlp-elser.html">Elastic Learned Sparse EncodeR</a> (ELSER) to provide additional context and recommendations from private data, alongside the large language models (LLMs) using RAG (Retrieval Augmented Generation). Elastic’s Stack — as a vector database with out-of-the-box semantic search and connectors to LLM integrations and the Observability solution — is the perfect toolkit to extract the maximum value of combining your company's unique observability knowledge with generative AI.</p>
<h2>Enhanced troubleshooting for SREs</h2>
<p>Site reliability engineers (SRE) in large organizations often face challenges in locating necessary information for troubleshooting alerts, monitoring systems, or deriving insights due to scattered and potentially outdated resources. This issue is particularly significant for less experienced SREs who may require assistance even with the presence of a runbook. Recurring incidents pose another problem, as the on-call individual may lack knowledge about previous resolutions and subsequent steps. Mature SRE teams often invest considerable time in system improvements to minimize &quot;fire-fighting,&quot; utilizing extensive automation and documentation to support on-call personnel.</p>
<p>Elastic® addresses these challenges by combining generative AI models with relevant search results from your internal data using RAG. The <a href="https://www.elastic.co/guide/en/observability/current/obs-ai-assistant.html">Observability AI Assistant's internal Knowledge Base</a>, powered by our semantic search retrieval model <a href="https://www.elastic.co/guide/en/machine-learning/current/ml-nlp-elser.html">ELSER</a>, can recall information at any point during a conversation, providing RAG responses based on internal knowledge.</p>
<p>This Knowledge Base can be enriched with your organization's information, such as runbooks, GitHub issues, internal documentation, and Slack messages, allowing the AI Assistant to provide specific assistance. The Assistant can also document and store specific information from an ongoing conversation with an SRE while troubleshooting issues, effectively creating runbooks for future reference. Furthermore, the Assistant can generate summaries of incidents, system status, runbooks, post-mortems, or public announcements.</p>
<p>This ability to retrieve, summarize, and present contextually relevant information is a game-changer for SRE teams, transforming the work from chasing documents and data to an intuitive, contextually sensitive user experience.The Knowledge Base (see <a href="https://www.elastic.co/guide/en/observability/current/obs-ai-assistant.html#obs-ai-requirements">requirements</a>) serves as a central repository of Observability knowledge, breaking documentation silos and integrating tribal knowledge, making this information accessible to SREs enhanced with the power of LLMs.</p>
<p>Your LLM provider may collect query telemetry when using the AI Assistant. If your data is confidential or has sensitive details, we recommend you verify the data treatment policy of the LLM connector you provided to the AI Assistant.</p>
<p>In this blog post, we will cover different ways to enrich your Knowledge Base (KB) with internal information. We will focus on a specific alert, indicating that there was an increase in logs with “502 Bad Gateway” errors that has surpassed the alert’s threshold.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/sre-troubleshooting-ai-assistant-observability-runbooks/elastic-blog-1.png" alt="1 - threshold breached" /></p>
<h2>How to troubleshoot an alert with the Knowledge Base</h2>
<p>Before the KB has been enriched with internal information, when the SRE asks the AI Assistant about how to troubleshoot an alert, the response from the LLM will be based on the data it learned during training; however, the LLM is not able to answer questions related to private, recent, or emerging knowledge. In this case, when asking for the steps to troubleshoot the alert, the response will be based on generic information.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/sre-troubleshooting-ai-assistant-observability-runbooks/elastic-blog-2.png" alt="2 - troubleshooting steps" /></p>
<p>However, once the KB has been enriched with your runbooks, when your team receives a new alert on “502 Bad Gateway” Errors, they can use AI Assistant to access the internal knowledge to troubleshoot it, using semantic search to find the appropriate runbook in the Knowledge Base.</p>
<p>In this blog, we will cover different ways to add internal information on how to troubleshoot an alert to the Knowledge Base:</p>
<ol>
<li>
<p>Ask the assistant to remember the content of an existing runbook.</p>
</li>
<li>
<p>Ask the Assistant to summarize and store in the Knowledge Base the steps taken during a conversation and store it as a runbook.</p>
</li>
<li>
<p>Import your runbooks from GitHub or another external source to the Knowledge Base using our Connector and APIs.</p>
</li>
</ol>
<p>After the runbooks have been added to the KB, the AI Assistant is now able to recall the internal and specific information in the runbooks. By leveraging the retrieved information, the LLM could provide more accurate and relevant recommendations for troubleshooting the alert. This could include suggesting potential causes for the alert, steps to resolve the issue, preventative measures for future incidents, or asking the assistant to help execute the steps mentioned in the runbook using functions. With more accurate and relevant information at hand, the SRE could potentially resolve the alert more quickly, reducing downtime and improving service reliability.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/sre-troubleshooting-ai-assistant-observability-runbooks/Screenshot_2023-11-10_at_9.52.38_AM.png" alt="3 - troubleshooting 502 Bad gateway" /></p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/sre-troubleshooting-ai-assistant-observability-runbooks/elastic-blog-4.png" alt="4 - (5) test the backend directly" /></p>
<p>Your Knowledge Base documents will be stored in the indices <em>.kibana-observability-ai-assistant-kb-</em>*. Have in mind that LLMs have restrictions on the amount of information the model can read and write at once, called token limit. Imagine you're reading a book, but you can only remember a certain number of words at a time. Once you've reached that limit, you start to forget the earlier words you've read. That's similar to how a token limit works in an LLM.</p>
<p>To keep runbooks within the token limit for Retrieval Augmented Generation (RAG) models, ensure the information is concise and relevant. Use bullet points for clarity, avoid repetition, and use links for additional information. Regularly review and update the runbooks to remove outdated or irrelevant information. The goal is to provide clear, concise, and effective troubleshooting information without compromising the quality due to token limit constraints. LLMs are great for summarization, so you could ask the AI Assistant to help you make the runbooks more concise.</p>
<h2>Ask the assistant to remember the content of an existing runbook</h2>
<p>The easiest way to store a runbook into the Knowledge Base is to just ask the AI Assistant to do it! Open a new conversation and ask “Can you store this runbook in the KB for future reference?” followed by pasting the content of the runbook in plain text.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/sre-troubleshooting-ai-assistant-observability-runbooks/elastic-blog-5.png" alt="5 - new conversation - let's work on this together" /></p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/sre-troubleshooting-ai-assistant-observability-runbooks/elastic-blog-6.png" alt="6 - new converastion" /></p>
<p>The AI Assistant will then store it in the Knowledge Base for you automatically, as simple as that.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/sre-troubleshooting-ai-assistant-observability-runbooks/elastic-blog-7.png" alt="7 - storing a runbook" /></p>
<h2>Ask the Assistant to summarize and store the steps taken during a conversation in the Knowledge Base</h2>
<p>You can also ask the AI Assistant to remember something while having a conversation — for example, after you have troubleshooted an alert using the AI Assistant, you could ask to &quot;remember how to troubleshoot this alert for next time.&quot; The AI Assistant will create a summary of the steps taken to troubleshoot the alert and add it to the Knowledge Base, effectively creating runbooks for future reference. Next time you are faced with a similar situation, the AI Assistant will recall this information and use it to assist you.</p>
<p>In the following demo, the user asks the Assistant to remember the steps that have been followed to troubleshoot the root cause of an alert, and also to ping the Slack channel when this happens again. In a later conversation with the Assistant, the user asks what can be done about a similar problem, and the AI Assistant is able to remember the steps and also reminds the user to ping the Slack channel.</p>
<p>After receiving the alert, you can open the AI Assistant chat and test troubleshooting the alert. After investigating an alert, ask the AI Assistant to summarize the analysis and the steps taken to root cause. To remember them for the next time, we have a similar alert and add extra instruction like to warn the Slack channel.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/sre-troubleshooting-ai-assistant-observability-runbooks/elastic-blog-8.png" alt="8. -teal box" /></p>
<p>The Assistant will use the built-in functions to summarize the steps and store them into your Knowledge Base, so they can be recalled in future conversations.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/sre-troubleshooting-ai-assistant-observability-runbooks/Screenshot_2023-11-08_at_11.34.08_AM.png" alt="9 - Elastic assistant chat (CROP)" /></p>
<p>Open a new conversation, and ask what are the steps to take when troubleshooting a similar alert to the one we just investigated. The Assistant will be able to recall the information stored in the KB that is related to the specific alert, using semantic search based on <a href="https://www.elastic.co/guide/en/machine-learning/current/ml-nlp-elser.html">ELSER</a>, and provide a summary of the steps taken to troubleshoot it, including the last indication of informing the Slack channel.</p>
&lt;Video vidyardUuid=&quot;p14Ss8soJDkW8YoCtKPrQF&quot; loop={true} /&gt;
<h2>Import your runbooks stored in GitHub to the Knowledge Base using APIs or our GitHub Connector</h2>
<p>You can also add proprietary data into the Knowledge Base programmatically by ingesting it (e.g., GitHub Issues, Markdown files, Jira tickets, text files) into Elastic.</p>
<p>If your organization has created runbooks that are stored in Markdown documents in GitHub, follow the steps in the next section of this blog post to index the runbook documents into your Knowledge Base.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/sre-troubleshooting-ai-assistant-observability-runbooks/elastic-blog-10.png" alt="10 - github handling 502" /></p>
<p>The steps to ingest documents into the Knowledge Base are the following:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/sre-troubleshooting-ai-assistant-observability-runbooks/elastic-blog-11.png" alt="11 - using internal knowledge" /></p>
<h3>Ingest your organization’s knowledge into Elasticsearch</h3>
<p><strong>Option 1:</strong> <strong>Use the</strong> <a href="https://www.elastic.co/guide/en/enterprise-search/current/crawler.html"><strong>Elastic web crawler</strong></a> <strong>.</strong> Use the web crawler to programmatically discover, extract, and index searchable content from websites and knowledge bases. When you ingest data with the web crawler, a search-optimized <a href="https://www.elastic.co/blog/what-is-an-elasticsearch-index">Elasticsearch® index</a> is created to hold and sync webpage content.</p>
<p><strong>Option 2: Use Elasticsearch's</strong> <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html"><strong>Index API</strong></a> <strong>.</strong> <a href="https://www.elastic.co/guide/en/cloud/current/ec-ingest-guides.html">Watch tutorials</a> that demonstrate how you can use the Elasticsearch language clients to ingest data from an application.</p>
<p><strong>Option 3: Build your own connector.</strong> Follow the steps described in this blog: <a href="https://www.elastic.co/search-labs/how-to-create-customized-connectors-for-elasticsearch">How to create customized connectors for Elasticsearch</a>.</p>
<p><strong>Option 4: Use Elasticsearch</strong> <a href="https://www.elastic.co/guide/en/workplace-search/current/workplace-search-content-sources.html"><strong>Workplace Search connectors</strong></a> <strong>.</strong> For example, the <a href="https://www.elastic.co/guide/en/workplace-search/current/workplace-search-github-connector.html">GitHub connector</a> can automatically capture, sync, and index issues, Markdown files, pull requests, and repos.</p>
<ul>
<li>Follow the steps to <a href="https://www.elastic.co/guide/en/workplace-search/current/workplace-search-github-connector.html#github-configuration">configure the GitHub Connector in GitHub</a> to create an OAuth App from the GitHub platform.</li>
</ul>
<p><img src="https://www.elastic.co/observability-labs/assets/images/sre-troubleshooting-ai-assistant-observability-runbooks/elastic-blog-12.png" alt="12 - elastic workplace search" /></p>
<ul>
<li>Now you can connect a GitHub instance to your organization. Head to your organization’s <strong>Search &gt; Workplace Search</strong> administrative dashboard, and locate the Sources tab.</li>
</ul>
<p><img src="https://www.elastic.co/observability-labs/assets/images/sre-troubleshooting-ai-assistant-observability-runbooks/Screenshot_2023-11-08_at_10.19.19_AM.png" alt="13 - screenshot" /></p>
<ul>
<li>Select <strong>GitHub</strong> (or GitHub Enterprise) in the Configured Sources list, and follow the GitHub authentication flow as presented. Upon the successful authentication flow, you will be redirected to Workplace Search and will be prompted to select the Organization you would like to synchronize.</li>
</ul>
<p><img src="https://www.elastic.co/observability-labs/assets/images/sre-troubleshooting-ai-assistant-observability-runbooks/elastic-blog-14.png" alt="14 - configure and connect" /></p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/sre-troubleshooting-ai-assistant-observability-runbooks/elastic-blog-15.png" alt="15 - how to add github" /></p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/sre-troubleshooting-ai-assistant-observability-runbooks/elastic-blog-16.png" alt="16 - github" /></p>
<ul>
<li>After configuring the connector and selecting the organization, the content should be synchronized and you will be able to see it in Sources. If you don’t need to index all the available content, you can specify the indexing rules via the API. This will help shorten indexing times and limit the size of the index. See <a href="https://www.elastic.co/guide/en/workplace-search/current/workplace-search-customizing-indexing-rules.html">Customizing indexing</a>.</li>
</ul>
<p><img src="https://www.elastic.co/observability-labs/assets/images/sre-troubleshooting-ai-assistant-observability-runbooks/elastic-blog-17.png" alt="17 - source overview" /></p>
<ul>
<li>The source has created an index in Elastic with the content (Issues, Markdown Files…) from your organization. You can find the index name by navigating to <strong>Stack Management &gt; Index Management</strong> , activating the <strong>Include hidden Indices</strong> button on the right, and searching for “GitHub.”</li>
</ul>
<p><img src="https://www.elastic.co/observability-labs/assets/images/sre-troubleshooting-ai-assistant-observability-runbooks/elastic-blog-18.png" alt="18 - index mgmt" /></p>
<ul>
<li>You can explore the documents you have indexed by creating a Data View and exploring it in Discover. Go to <strong>Stack Management &gt; Kibana &gt; Data Views &gt; Create data view</strong> and introduce the data view Name, Index pattern (make sure you activate “Allow hidden and system indices” in advanced options), and Timestamp field:</li>
</ul>
<p><img src="https://www.elastic.co/observability-labs/assets/images/sre-troubleshooting-ai-assistant-observability-runbooks/elastic-blog-19.png" alt="19 - create data view" /></p>
<ul>
<li>You can now explore the documents in Discover using the data view:</li>
</ul>
<p><img src="https://www.elastic.co/observability-labs/assets/images/sre-troubleshooting-ai-assistant-observability-runbooks/elastic-blog-20.png" alt="20 - data view" /></p>
<h3>Reindex your internal runbooks into the AI Assistant’s Knowledge Base Index, using it's semantic search pipeline</h3>
<p>Your Knowledge Base documents are stored in the indices <em>.kibana-observability-ai-assistant-kb-*</em>. To add your internal runbooks imported from GitHub to the KB, you just need to reindex the documents from the index you created in the previous step to the KB’s index. To add the semantic search capabilities to the documents in the KB, the reindex should also use the ELSER pipeline preconfigured for the KB, <em>.kibana-observability-ai-assistant-kb-ingest-pipeline</em>.</p>
<p>By creating a Data View with the KB index, you can explore the content in Discover.</p>
<p>You execute the query below in <strong>Management &gt; Dev Tools</strong> , making sure to replace the following, both on “_source” and “inline”:</p>
<ul>
<li>InternalDocsIndex : name of the index where your internal docs are stored</li>
<li>text_field : name of the field with the text of your internal docs</li>
<li>timestamp : name of the field of the timestamp in your internal docs</li>
<li>public : (true or false) if true, makes a document available to all users in the defined <a href="https://www.elastic.co/guide/en/kibana/current/xpack-spaces.html">Kibana Space</a> (if is defined) or in all spaces (if is not defined); if false, document will be restricted to the user indicated in</li>
<li>(optional) space : if defined, restricts the internal document to be available in a specific <a href="https://www.elastic.co/guide/en/kibana/current/xpack-spaces.html">Kibana Space</a></li>
<li>(optional) user.name : if defined, restricts the internal document to be available for a specific user</li>
<li>(optional) &quot;query&quot; filter to index only certain docs (see below)</li>
</ul>
<pre><code class="language-bash">POST _reindex
{
    &quot;source&quot;: {
        &quot;index&quot;: &quot;&lt;InternalDocsIndex&gt;&quot;,
        &quot;_source&quot;: [
            &quot;&lt;text_field&gt;&quot;,
            &quot;&lt;timestamp&gt;&quot;,
            &quot;namespace&quot;,
            &quot;is_correction&quot;,
            &quot;public&quot;,
            &quot;confidence&quot;
        ]
    },
    &quot;dest&quot;: {
        &quot;index&quot;: &quot;.kibana-observability-ai-assistant-kb-000001&quot;,
        &quot;pipeline&quot;: &quot;.kibana-observability-ai-assistant-kb-ingest-pipeline&quot;
    },
    &quot;script&quot;: {
        &quot;inline&quot;: &quot;ctx._source.text=ctx._source.remove(\&quot;&lt;text_field&gt;\&quot;);ctx._source.namespace=\&quot;&lt;space&gt;\&quot;;ctx._source.is_correction=false;ctx._source.public=&lt;public&gt;;ctx._source.confidence=\&quot;high\&quot;;ctx._source['@timestamp']=ctx._source.remove(\&quot;&lt;timestamp&gt;\&quot;);ctx._source['user.name'] = \&quot;&lt;user.name&gt;\&quot;&quot;
    }
}
</code></pre>
<p>You may want to specify the type of documents that you reindex in the KB — for example, you may only want to reindex Markdown documents (like Runbooks). You can add a “query” filter to the documents in the source. In the case of GitHub, runbooks are identified with the “type” field containing the string “file,” and you could add that to the reindex query like indicated below. To add also GitHub Issues, you can also include in the query “type” field containing the string “issues”:</p>
<pre><code class="language-json">&quot;source&quot;: {
        &quot;index&quot;: &quot;&lt;InternalDocsIndex&gt;&quot;,
        &quot;_source&quot;: [
            &quot;&lt;text_field&gt;&quot;,
            &quot;&lt;timestamp&gt;&quot;,
            &quot;namespace&quot;,
            &quot;is_correction&quot;,
            &quot;public&quot;,
            &quot;confidence&quot;
        ],
    &quot;query&quot;: {
      &quot;terms&quot;: {
        &quot;type&quot;: [&quot;file&quot;]
      }
    }
</code></pre>
<p>Great! Now that the data is stored in your Knowledge Base, you can ask the Observability AI Assistant any questions about it:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/sre-troubleshooting-ai-assistant-observability-runbooks/elastic-blog-21.png" alt="21 - new conversation" /></p>
&lt;Video vidyardUuid=&quot;zRxsp1EYjmR4FW4yRtSxcr&quot; loop={true} /&gt;
&lt;Video vidyardUuid=&quot;vV5md3mVtY8KxUVjSvtT7V&quot; loop={true} /&gt;
<h2>Conclusion</h2>
<p>In conclusion, leveraging internal Observability knowledge and adding it to the Elastic Knowledge Base can greatly enhance the capabilities of the AI Assistant. By manually inputting information or programmatically ingesting documents, SREs can create a central repository of knowledge accessible through the power of Elastic and LLMs. The AI Assistant can recall this information, assist with incidents, and provide tailored observability to specific contexts using Retrieval Augmented Generation. By following the steps outlined in this article, organizations can unlock the full potential of their Elastic AI Assistant.</p>
<p><a href="https://www.elastic.co/generative-ai/ai-assistant">Start enriching your Knowledge Base with the Elastic AI Assistant today</a> and empower your SRE team with the tools they need to excel. Follow the steps outlined in this article and take your incident management and alert remediation processes to the next level. Your journey toward a more efficient and effective SRE operation begins now.</p>
<p><em>The release and timing of any features or functionality described in this post remain at Elastic's sole discretion. Any features or functionality not currently available may not be delivered on time or at all.</em></p>
<p><em>In this blog post, we may have used or referred to third party generative AI tools, which are owned and operated by their respective owners. Elastic does not have any control over the third party tools and we have no responsibility or liability for their content, operation or use, nor for any loss or damage that may arise from your use of such tools. Please exercise caution when using AI tools with personal, sensitive or confidential information. Any data you submit may be used for AI training or other purposes. There is no guarantee that information you provide will be kept secure or confidential. You should familiarize yourself with the privacy practices and terms of use of any generative AI tools prior to use.</em></p>
<p><em>Elastic, Elasticsearch, ESRE, Elasticsearch Relevance Engine and associated marks are trademarks, logos or registered trademarks of Elasticsearch N.V. in the United States and other countries. All other company and product names are trademarks, logos or registered trademarks of their respective owners.</em></p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/sre-troubleshooting-ai-assistant-observability-runbooks/11-hand.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[Better RCAs with multi-agent AI Architecture]]></title>
            <link>https://www.elastic.co/observability-labs/blog/super-agent-architecture</link>
            <guid isPermaLink="false">super-agent-architecture</guid>
            <pubDate>Fri, 31 May 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[Discover how specialized LLM agents collaborate to tackle complex tasks with unparalleled efficiency]]></description>
            <content:encoded><![CDATA[<h2>What’s a multi agent architecture?</h2>
<p>You might have heard the term Agent pop up recently in different open source projects or vendors focusing their go-to-market on GenAI. Indeed, while most GenAI applications are focused on RAG applications today, there is an increasing interest in isolating tasks that could be achieved with a more special model into what is called an Agent.</p>
<p>To be clear, an agent will be given a task, which could be a prompt, and execute the task by leveraging other models, data sources, and a knowledge base. Depending on the field of application, the results should ultimately look like generated text, pictures, charts, or sounds.</p>
<p>Now, what the multi-Agent Architecture, is the process of leveraging multiple agents around a given task by:</p>
<ul>
<li>Orchestrating complex system oversight with multiple agents</li>
<li>Analyzing and strategizing in real-time with strategic reasoning</li>
<li>Specializing agents, tasks are decomposed into smaller focused tasks into expert-handled elements</li>
<li>Sharing insights for cohesive action plans, creating collaborative dynamics</li>
</ul>
<p>In a nutshell, multi-agent architecture's superpower is tackling intricate challenges beyond human speed and solving complex problems. It enables a couple of things:</p>
<ul>
<li>Scale the intelligence as the data and complexity grows. The tasks are decomposed into smaller work units, and the expert network grows accordingly.</li>
<li>Coordinate simultaneous actions across systems, scale collaboration</li>
<li>Evolving with data allows continuous adaptation with new data for cutting-edge decision-making.</li>
<li>Scalability, high performance, and resilience</li>
</ul>
<h2>Single Agent Vs Multi-Agent Architecture</h2>
<p>Before double-clicking on the multi-agent architecture, let’s talk about the single-agent architecture. The single-agent architecture is designed for straightforward tasks and a late feedback loop from the end user. There are multiple single-agent frameworks such as ReAct (Reason+Act), RAISE (ReAct+ Short/Long term memory), Reflexion, AutoGPT+P, and LATS (Language Agent Tree Search). The general process these architectures enable is as follows:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/super-agent-architecture/single.png" alt="alt_text" /></p>
<p>The Agent takes action, observes, executes, and self-decides whether or not it looks complete, ends the process if finished, or resubmits the new results as an input action, the process keeps going.</p>
<p>While simple tasks are ok with this type of agent, such as a RAG application where a user will ask a question, and the agent returns an answer based on the LLM and a knowledge base, there are a couple of limitations:</p>
<ul>
<li>Endless execution loop: the agent is never satisfied with the output and reiterates.</li>
<li>Hallucinations</li>
<li>Lack of feedback loop or enough data to build a feedback loop</li>
<li>Lack of planning</li>
</ul>
<p>For these reasons, the need for a better self-evaluation loop, externalizing the observation phase, and division of labor is rising, creating the need for a multi-agent architecture.</p>
<p>Multi-agent architecture relies on taking a complex task, breaking it down into multiple smaller tasks, planning the resolution of these tasks, executing, evaluating, sharing insights, and delivering an outcome. For this, there is more than one agent; in fact, the minimum value for the network size N is N=2 with:</p>
<ul>
<li>A Manager</li>
<li>An Expert</li>
</ul>
<p>When N=2, the source task is simple enough only to need one expert agent as the task can not be broken down into multiple tasks. Now, when the task is more complex, this is what the architecture can look like:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/super-agent-architecture/multi-vertical.png" alt="alt_text" /></p>
<p>With the help of an LLM, the Manager decomposes the tasks and delegates the resolutions to multiple agents. The above architecture is called Vertical since the agents directly send their results to the Manager. In a horizontal architecture, agents work and share insight together as groups, with a volunteer-based system to complete a task, they do not need a leader as shown below:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/super-agent-architecture/multi-horizontal.png" alt="alt_text" /></p>
<p>A very good paper covering these two architectures with more insights can be found here: <a href="https://arxiv.org/abs/2404.11584">https://arxiv.org/abs/2404.11584</a></p>
<h2>Application Vertical Multi-Agent Architecture to Observability</h2>
<p>Vertical Multi-Agent Architecture can have a manager, experts, and a communicator. This is particularly important when these architectures expose the task's result to an end user.</p>
<p>In the case of Observability, what we envision in this blog post is the scenario of an SRE running through a Root Cause Analysis (RCA) process. The high-level logic will look like this:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/super-agent-architecture/maar-observability.png" alt="alt_text" /></p>
<ul>
<li>Communicator:
<ul>
<li>Read the initial command from the Human</li>
<li>Pass command to Manager</li>
<li>Provide status updates to Human</li>
<li>Provide a recommended resolution plan to the Human</li>
<li>Relay follow-up commands from Human to Manager</li>
</ul>
</li>
<li>Manager:
<ul>
<li>Read the initial command from the Communicator </li>
<li>Create working group </li>
<li>Assign Experts to group </li>
<li>Evaluate signals and recommendations from Experts </li>
<li>Generate recommended resolution plan </li>
<li>Execute plan (optional)</li>
</ul>
</li>
<li>Expert:
<ul>
<li>Each expert task with singular expertise tied to Elastic integration </li>
<li>Use o11y AI Assistant to triage and troubleshoot data related to their expertise </li>
<li>Work with other Experts as needed to correlate issues </li>
<li>Provide recommended root cause analysis for their expertise (if applicable) </li>
<li>Provide recommended resolution plan for their expertise (if applicable)</li>
</ul>
</li>
</ul>
<p>We believe that breaking down the experts by integration provides enough granularity in the case of observability and allows them to focus on a specific data source. Doing this also gives the manager a breakdown key when receiving a complex incident involving multiple data layers (application, network, datastores, infrastructures).</p>
<p>For example, a complex task initiated by an alert in an e-commerce application could be “Revenue dropped by 30% in the last hour.” This task would be submitted to the manager, who will look at all services, applications, datastores, network components, and infrastructure involved and decompose these into investigation tasks. Each expert would investigate within their specific scope and provide observations to the manager. The manager will be responsible for correlating and providing observations on what caused the problem.</p>
<h3>Core Architecture</h3>
<p>In the above example, we have decided to deploy the architecture on the below software architecture:</p>
<ul>
<li>The agent manager and expert agent are deployed on GCP or your favorite cloud provider</li>
<li>Most of the components are written in Python</li>
<li>A task management layer is necessary to queue the task to the expert</li>
<li>Expert agents are specifically deployed by integration/data source and converse with the Elastic AI Assistant deployed in Kibana.</li>
<li>The AI Assistant can access a real-time context to help the expert resolve their task.</li>
<li>Elasticsearch is used as the AI Assistant context and as the expert memory to build its experience.</li>
<li>The backend LLM here is GPT-4, now GTP-4o, running on Azure.</li>
</ul>
<p><img src="https://www.elastic.co/observability-labs/assets/images/super-agent-architecture/core-architecture.png" alt="alt_text" /></p>
<h3>Agent Experience</h3>
<p>Agent experience is built based on previous events stored in Elasticsearch, to which the expert can look semantically for similar events. When they find one, they get the execution path stored in memory to execute it.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/super-agent-architecture/agent-experience.png" alt="alt_text" /></p>
<p>The beauty of using the Elasticsearch Vector Database for this is the semantic query the agent will be able to execute against the memory and how the memory itself can be managed. Indeed, there is a notion of short—and long-term memory that could be very interesting in the case of observability, where some events often happen and probably worth to be stored in the short-term memory because they are questioned more often. Less queried but important events can be stored in a longer-term memory with more cost-effective hardware.</p>
<p>The other aspect of the Agent Experience is the semantic <a href="https://www.elastic.co/search-labs/blog/semantic-reranking-with-retrievers">reranking</a> feature with Elasticsearch. When the agent executes a task, reranking is used to surface the best outcome compared to past experience:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/super-agent-architecture/agent-experience-build.png" alt="alt_text" /></p>
<p>If you are looking for a working example of the above, <a href="https://www.elastic.co/observability-labs/blog/elastic-ai-assistant-observability-escapes-kibana">check this blog post</a> where 2 agents are working together with the Elastic Observability AI Assistant on an RCA:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/super-agent-architecture/ops-burger.png" alt="alt_text" /></p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/super-agent-architecture/githubcopilot-aiassistant.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[Transforming Industries and the Critical Role of LLM Observability: How to use Elastic's LLM integrations in real-world scenarios]]></title>
            <link>https://www.elastic.co/observability-labs/blog/transforming-industries-and-the-critical-role-of-llm-observability</link>
            <guid isPermaLink="false">transforming-industries-and-the-critical-role-of-llm-observability</guid>
            <pubDate>Thu, 08 May 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[This blog explores four industry specific use cases that use Large Language Models (LLMs) and highlights how Elastic's LLM observability integrations provide insights into the cost, performance, reliability and the prompts and response exchange with the LLM.]]></description>
            <content:encoded><![CDATA[<p>In today's tech-centric world, Large Language Models (LLMs) are transforming sectors from finance and healthcare to research. LLMs are starting to underpin products and services across the spectrum. Take for example recent <a href="https://blog.google/technology/google-deepmind/gemini-model-thinking-updates-march-2025/#advanced-coding">advanced coding</a> developments in Google's Gemini 2.5 which enable it to use its reasoning capabilities to create a video game by producing the executable code from a short prompt.  Or <a href="https://www.aboutamazon.com/news/devices/new-alexa-generative-artificial-intelligence">new ways</a> to interact with Amazon's Alexa - for example, you could send a picture of a live music schedule, and have Alexa add the details to your calendar. And let's not forget Microsoft's <a href="https://blogs.microsoft.com/blog/2025/04/04/your-ai-companion/">personalization of Copilot</a> which remembers what you talk about, so it learns your likes and dislikes and details about your life; the name of your dog, that tricky project at work, what keeps you motivated to stick to your new workout routine.</p>
<p>Despite their widespread utility of LLMs, deploying these sophisticated tools in real-world scenarios poses distinct challenges, especially in managing their complex behaviors. For users such as Site Reliability Engineers (SREs), DevOps teams, and AI/ML engineers, ensuring reliability, performance, and compliance of these models introduces an additional  layer of complexity. This is where the concept of LLM Observability becomes essential. It offers crucial insights into the performance of these models, ensuring that these advanced AI systems operate both effectively and ethically.</p>
<h3>Why LLM Observability Matters and How Elastic Makes It Easy</h3>
<p>LLMs are not just another piece of software; they are sophisticated systems capable of human-like capabilities such as text generation, comprehension, and even coding. But with great power comes greater need for oversight. The opaque nature of these models can obscure how decisions are made and content generated. This makes it even more critical to implement robust observability to monitor and troubleshoot issues such as hallucinations, inappropriate content, cost overruns, errors and performance degradation. By monitoring these models closely, we can safeguard against unexpected outcomes and maintain user trust.</p>
<h3>Real-World Scenarios</h3>
<p>Let's explore real-world scenarios where companies leverage LLM-powered applications to enhance productivity and user experience, and how Elastic's LLM observability solutions monitor critical aspects of these models.</p>
<h4>1. Generative AI for Customer Support</h4>
<p>Companies are increasingly leveraging LLMs and generative AI to enhance customer support, using platforms like Google Vertex AI for hosting these models efficiently. With the introduction of advanced AI models such as Google's Gemini, which is integrated into Vertex AI, businesses can deploy sophisticated chatbots that manage customer inquiries, from basic questions to complex issues, in real time. These AI systems understand and respond with natural language, offering instant support for issues such as product troubleshooting or managing orders thus
reducing wait times. They also learn from each interaction to improve accuracy continuously. This boosts customer satisfaction and allows human agents to focus on complex tasks, enhancing overall efficiency. Other ways that AI tools can further empower customer care agents is with real-time analytics, sentiment detection, and conversation summarization.</p>
<p>To support use cases like the AI-powered customer support described above, Elastic recently launched LLM observability integrations including support for <a href="https://www.elastic.co/guide/en/integrations/current/gcp_vertexai.html">LLMs hosted on GCP Vertex AI</a>. Customers who wish to monitor foundation models such as Gemini and Imagen hosted on Google Vertex AI can benefit from Elastic’s Vertex AI integration to get a deeper understanding of model behavior and performance, and ensure that the AI-driven tools are not only effective but also reliable. Customers get out-of-the-box experience ingesting a curated set of metrics from Vertex AI as well as a pre-configured dashboard.</p>
<p>By continuously tracking these metrics, customers can proactively manage their AI resources, optimize operations, and ultimately enhance the overall customer experience.</p>
<p>Let's look at some of the metrics you get from the Google Vertex AI integration which are helpful in the context of using generative AI for customer support.</p>
<ol>
<li><strong>Prediction Latency</strong>: Measures the time taken to complete predictions, critical for real-time customer interactions.</li>
<li><strong>Error Rate</strong>: Tracks errors in predictions, which is vital for maintaining the accuracy and reliability of AI-driven customer support.</li>
<li><strong>Prediction Count</strong>: Counts the number of predictions made, helping assess the scale of AI usage in customer interactions.</li>
<li><strong>Model Usage</strong>: Tracks how frequently the AI models are accessed by both virtual assistants and customer support tools.</li>
<li><strong>Total Invocations</strong>: Measures the total number of times the AI services are used, providing insights into user engagement and dependency on these tools.</li>
<li><strong>CPU and Memory Utilization</strong>: By observing CPU and memory usage, users can optimize resource allocation, ensuring that the AI tools are running efficiently without overloading the system.</li>
</ol>
<p><img src="https://www.elastic.co/observability-labs/assets/images/transforming-industries-and-the-critical-role-of-llm-observability/vertex-overview.png" alt="Vertex Overview" /></p>
<p>To learn more about how Elastic's Google Vertex AI integration can augment your LLM observability, have a quick read of this <a href="https://www.elastic.co/observability-labs/blog/elevate-llm-observability-with-gcp-vertex-ai-integration">blog</a>.</p>
<h4>2. Transforming Healthcare with Generative AI</h4>
<p>The healthcare industry is embracing generative AI to enhance patient interactions and streamline operational workflows. By leveraging platforms like Amazon Bedrock, healthcare organizations deploy advanced large language models (LLMs) to power tools that convert doctor-patient conversations into structured medical notes, reducing administrative overhead and allowing clinicians to prioritize diagnosis and treatment. These AI-driven solutions provide real-time insights, enabling informed decision-making and improving patient outcomes. Additionally, patient-facing applications powered by LLMs offer secure access to health records, empowering individuals to manage their care proactively.</p>
<p>Robust observability is essential to maintain the reliability and performance of these generative AI applications in healthcare. Elastic’s <a href="https://www.elastic.co/guide/en/integrations/current/aws_bedrock.html">Amazon Bedrock integration</a> equips providers with tools to monitor LLM behavior, capturing critical metrics like invocation latency, error rates, token usage and guardrail invocation. Pre-configured dashboards provide visibility into prompt and completion text, enabling teams to verify the accuracy of AI-generated outputs, such as medical notes, and detect issues like hallucinations.</p>
<p>Additionally, customers who configure Guardrails for Amazon Bedrock to filter harmful content like hate speech, personal insults, and other inappropriate topics, can use the Bedrock Integration to observe the prompts and responses that caused the guardrail to filter them out. This helps application developers take proactive actions to maintain a safe and positive user experience.</p>
<p>Some of the logs and metrics that can be helpful for customers using LLMs hosted on Amazon Bedrock are the following</p>
<ol>
<li><strong>Invocation Details</strong>: This Integration records the Invocation latency, count, throttles. These metrics are critical for ensuring that generative AI models respond quickly and accurately to patient queries or appointment scheduling tasks, maintaining a seamless user experience.</li>
<li><strong>Error Rates</strong>:  Tracking error rates ensures that AI tools, such as patient query assistants or appointment systems, consistently deliver accurate and reliable results. By identifying and addressing issues early, healthcare providers can maintain trust in AI systems and prevent disruptions in critical patient interactions.</li>
<li><strong>Token Usage</strong>: In healthcare, tracking token usage helps identify resource-intensive queries, such as detailed patient record summaries or complex symptom analyses, ensuring efficient model operation. By monitoring token usage, healthcare providers can optimize costs for AI-powered tools while maintaining scalability to handle growing patient interactions.</li>
<li><strong>Prompt and Completion Text</strong>: Capturing prompt and completion text allows healthcare providers to analyze how AI models respond to specific patient queries or administrative tasks, ensuring meaningful and contextually accurate interactions. This insight helps refine prompts to improve the AI's understanding and ensures that generated responses, such as appointment details or treatment explanations, meet the quality standards expected in healthcare.</li>
<li><strong>Prompt and response where guardrails intervened</strong>: Being able to track requests and responses that were deemed inappropriate by guardrails helps healthcare providers monitor what information patients are asking for. With this information users can make continuous adjustments to the LLMs to ensure appropriate responses, balancing flexibility and rich communication on the one hand, and on the other, privacy protection, hallucination prevention, and harmful content filtering.</li>
</ol>
<p><img src="https://www.elastic.co/observability-labs/assets/images/transforming-industries-and-the-critical-role-of-llm-observability/aws-bedrock-overview.png" alt="Bedrock Overview" /></p>
<p>Amazon Bedrock Gaurdrails OOTB dashboard
<img src="https://www.elastic.co/observability-labs/assets/images/transforming-industries-and-the-critical-role-of-llm-observability/amazon-bedrock-gaurdrails.png" alt="Bedrock Gaurdrails Overview" /></p>
<p>To learn about the Amazon Bedrock Integration, read this <a href="https://www.elastic.co/observability-labs/blog/llm-observability-aws-bedrock">blog</a>. To dive deeper into how the integration can help with observability of Guardrails for Amazon Bedrock, take a look at this <a href="https://www.elastic.co/observability-labs/blog/llm-observability-amazon-bedrock-guardrails">blog</a>.</p>
<h4>3.  Enhancing Telco Efficiency with GenAI</h4>
<p>The telecommunication industry can leverage services like Azure OpenAI to transform customer interactions, optimize operations, and enhance service delivery. By integrating advanced generative AI models, telcos can offer highly personalized and responsive customer experiences across multiple channels. AI-powered virtual assistants streamline customer support by automating routine queries and providing accurate, context-aware responses, reducing the workload on human agents and enabling them to focus on complex issues while improving efficiency and satisfaction. Additionally, AI-driven insights help telcos understand customer preferences, anticipate needs, and deliver tailored offerings that boost customer loyalty. Operationally, LLMs such as Azure OpenAI enhance internal processes by enabling smarter knowledge management and faster access to critical information.</p>
<p>Elastic's LLM observability integrations like the <a href="https://www.elastic.co/guide/en/integrations/current/azure_openai.html">Azure OpenAI integration</a> can provide visibility into AI performance and costs, empowering telecom providers to make data-driven decisions and enhance customer engagement. It can help optimize resource allocation by analyzing call patterns, predicting service demands, and identifying trends, enabling telcos to scale their AI operations efficiently while maintaining high service quality.</p>
<p>Some of the key metrics and logs that Azure OpenAI that can provide insights are:</p>
<ol>
<li><strong>Error Counts</strong>: It provides critical insights into failed requests and incomplete transactions, enabling telecom providers to proactively identify and resolve issues in AI-powered applications.</li>
<li><strong>Prompt Input and Completion Text</strong>: This captures the input queries provided to AI systems and the corresponding AI-generated outputs. These fields allow telecom providers to analyze customer queries, monitor response quality, and refine AI training datasets to improve relevance and accuracy.</li>
<li><strong>Response Latency</strong>: It measures the time taken by AI models to generate responses, ensuring that virtual assistants and automated systems deliver quick and efficient replies to customer queries.</li>
<li><strong>Token Usage</strong>: It tracks the number of input and output tokens processed by the AI model, offering insights into resource consumption and cost efficiency. This data helps telecom providers monitor AI usage patterns, optimize configurations, and scale resources effectively</li>
<li><strong>Content Filter Results</strong>: In Azure OpenAI, this plays a crucial role in handling sensitive inputs provided by customers, ensuring compliance, safety, and responsible AI usage. This feature identifies and flags potentially inappropriate or harmful queries and responses in real time, enabling telecom providers to address sensitive topics with care and accuracy.</li>
</ol>
<p><img src="https://www.elastic.co/observability-labs/assets/images/transforming-industries-and-the-critical-role-of-llm-observability/azure-openai-overview.png" alt="Azureopenai Overview" /></p>
<p>The Azure OpenAI content filtering OOTB dashboard
<img src="https://www.elastic.co/observability-labs/assets/images/transforming-industries-and-the-critical-role-of-llm-observability/azure-openai-contentfiltering.png" alt="Azureopenai Overview1" /></p>
<p>You can learn more about Elastic's Azure OpenAI integration from these two blogs - <a href="https://www.elastic.co/observability-labs/blog/llm-observability-azure-openai">Part 1</a> and <a href="https://www.elastic.co/observability-labs/blog/llm-observability-azure-openai-v2">Part 2</a>.</p>
<h4>4. OpenAI Integration for Generative AI Applications</h4>
<p>As AI-powered solutions become integral to modern workflows, OpenAI's sophisticated models, including language models like GPT-4o and GPT-3.5 Turbo, image generation models like DALL·E, and audio processing models like Whisper, drive innovation across applications such as virtual assistants, content creation, and speech-to-text systems. With growing complexity and scale, ensuring these models perform reliably, remain cost-efficient, and adhere to ethical guidelines is paramount. Elastic's <a href="https://www.elastic.co/docs/reference/integrations/openai">OpenAI integration</a> provides a robust solution, offering deep visibility into model behaviour to support seamless and responsible AI deployments.</p>
<p>By tapping into the OpenAI Usage API, Elastic's integration delivers actionable insights through intuitive, pre-configured dashboards, enabling Site Reliability Engineers (SREs) and DevOps teams to monitor performance and optimize resource usage across OpenAI's diverse model portfolio. This unified observability approach empowers organizations to track critical metrics, identify inefficiencies, and maintain high-quality AI-driven experiences. The following key metrics from Elastic's OpenAI integration help organizations achieve effective oversight:</p>
<ol>
<li><strong>Request Latency</strong>: Measures the time taken for OpenAI models to process requests, ensuring responsive performance for real-time applications like chatbots or transcription services.</li>
<li><strong>Invocation Rates</strong>: Tracks the frequency of API calls across models, providing insights into usage patterns and helping identify high-demand workloads.</li>
<li><strong>Token Usage</strong>: Monitors input and output tokens (e.g., prompt, completion, cached tokens) to optimize costs and fine-tune prompts for efficient resource consumption.</li>
<li><strong>Error Counts</strong>: Captures failed requests or incomplete transactions, enabling proactive issue resolution to maintain application reliability.</li>
<li><strong>Image Generation Metrics</strong>: Tracks invocation rates and output dimensions for models like DALL·E, helping assess costs and usage trends in image-based applications.</li>
<li><strong>Audio Transcription Metrics</strong>: Monitors invocation rates and transcribed seconds for audio models like Whisper, supporting cost optimization in speech-to-text workflows.</li>
</ol>
<p><img src="https://www.elastic.co/observability-labs/assets/images/transforming-industries-and-the-critical-role-of-llm-observability/openai-overview.png" alt="Openai Overview" /></p>
<p>To learn more about Elastic's OpenAI integration, read this <a href="https://www.elastic.co/observability-labs/blog/llm-observability-openai">blog</a>.</p>
<h4>Actionable LLM Observability</h4>
<p>Elastic's LLM observability integrations empower users to take proactive control of their AI operations through actionable insights and real-time alerts. For instance, by setting a predefined threshold for token count, Elastic can trigger automated alerts when usage exceeds this limit, notifying Site Reliability Engineers (SREs) or DevOps teams via email, Slack, or other preferred channels. This ensures prompt awareness of potential cost overruns or resource-intensive queries, enabling teams to adjust model configurations or scale resources swiftly to maintain operational efficiency.</p>
<p>In the example below, the rule is set to alert the user if token_count crosses a threshold of 500.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/transforming-industries-and-the-critical-role-of-llm-observability/slo-1.png" alt="SLO Overview" /></p>
<p>The alert is triggered when the token count exceeds the threshold as seen below
<img src="https://www.elastic.co/observability-labs/assets/images/transforming-industries-and-the-critical-role-of-llm-observability/slo-2.png" alt="SLO Overview1" /></p>
<p>Another example is tracking invocation spikes, such as when the number of predictions or API calls surpasses a defined Service Level Objective (SLO). For example, if a Bedrock AI-hosted model experiences a sudden surge in invocations due to increased customer interactions, Elastic can alert teams to investigate potential anomalies or scale infrastructure accordingly. These proactive measures help maintain the reliability and cost-effectiveness of LLM-powered applications.</p>
<p>By providing pre-configured dashboards and customizable alerts, Elastic ensures that organizations can respond to critical events in real time, keeping their AI systems aligned with cost and performance goals as well as standards for content safety and reliability.</p>
<h4>Conclusion</h4>
<p>LLMs are transforming industries, but their complexity requires effective oversight observability to ensure their reliability and safe use. Elastic's LLM observability integrations provide a comprehensive solution, empowering businesses to monitor performance, manage resources, and address challenges like hallucinations and content safety. As LLMs become increasingly integral to various sectors, robust observability tools like those offered by Elastic ensure that these AI-driven innovations remain dependable, cost-effective, and aligned with ethical and safety standards.</p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/transforming-industries-and-the-critical-role-of-llm-observability/llmobs2.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[Windows Event Log Monitoring with OpenTelemetry & Elastic Streams]]></title>
            <link>https://www.elastic.co/observability-labs/blog/windows-event-monitoring-with-opentelemetry-and-elastic-streams</link>
            <guid isPermaLink="false">windows-event-monitoring-with-opentelemetry-and-elastic-streams</guid>
            <pubDate>Thu, 05 Feb 2026 00:00:00 GMT</pubDate>
            <description><![CDATA[Learn how to enhance Windows Event Log monitoring with OpenTelemetry for standardized ingestion and Elastic Streams for smart partitioning and analysis.]]></description>
            <content:encoded><![CDATA[<p>For system administrators and SREs, Windows Event Logs are both a goldmine and a graveyard. They contain the critical data needed to diagnose the root cause of a server crash or a security breach, but they are often buried under gigabytes of noise. Traditionally, extracting value from these logs required brittle regex parsers, manual rule creation, and a significant amount of human intuition.</p>
<p>However, the landscape of log management is shifting. By combining the industry-standard ingestion of OpenTelemetry (OTel) with the AI-driven capabilities of Elastic Streams, we can change how we monitor Windows infrastructure. This approach isn't just moving data. We are also using Large Language Models (LLMs) to understand it.</p>
<h2>The Challenge with Traditional Windows Logging</h2>
<p>Windows generates a massive variety of logs: System, Security, Application, Setup, and Forwarded Events. Within those categories, you have thousands of Event IDs. Historically, getting this data into an observability platform involved installing proprietary agents and configuring complex pipelines to strip out the XML headers and format the messages.</p>
<p>Once the data was ingested, we can try to figure out what &quot;bad&quot; looked like. You had to know in advance that Event ID 7031 indicated a service crash, and then write a specific alert for it. If you missed a specific Event ID or if the format changed, your monitoring went dark.</p>
<h2>Step 1: Ingestion via OpenTelemetry</h2>
<p>The first step in modernizing this workflow is adopting OpenTelemetry. The OTel collector has matured significantly and now offers robust support for Windows environments. By installing the collector directly on Windows servers, you can configure receivers to tap into the event log subsystems.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/windows-event-monitoring-with-opentelemetry-and-elastic-streams/otel-config.png" alt="OTel collector configuration for Windows Event Logs" /></p>
<p>The beauty of this approach is standardization. You aren't locked into a vendor-specific shipping agent. The OTel collector acts as a universal router, grabbing the logs and sending them to your observability backend in this case, the Elastic logs index designed to handle high-throughput streams.</p>
<p>The key thing to pay attention to in this configuration is how we add this transform statement:</p>
<pre><code class="language-yaml">transform/logs-streams:
  log_statements:
    - context: resource
      statements:
        - set(attributes[&quot;elasticsearch.index&quot;], &quot;logs&quot;)
</code></pre>
<p>This works with the vanilla opentelemetry collector and when the data arrives in Elastic, it tells Elastic to use the new wired streams feature which enables all the downstream AI features we discuss in later steps.</p>
<p>Checkout my example configuration <a href="https://github.com/davidgeorgehope/otel-collector-windows/blob/main/config.yaml">here</a></p>
<h2>Step 2: AI-Driven Partitioning</h2>
<p>Once the data arrives, the next challenge is organization. Dumping all Windows logs into a single <code>logs-*</code> index is a recipe for slow queries and confusion. In the past, we split indices based on hardcoded fields. Now, we can use AI to &quot;fingerprint&quot; the data.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/windows-event-monitoring-with-opentelemetry-and-elastic-streams/ai-partitioning.png" alt="AI-driven partitioning of Windows logs" /></p>
<p>This process involves analyzing the incoming stream to identify patterns. The system looks at the structure and content of the logs to determine their origin. For example, it can distinguish between a <code>Windows Security Audit</code> log and a <code>Service Control Manager</code> log purely based on the data shape.</p>
<p>The result is automatic partitioning. The system creates separate, optimized &quot;buckets&quot; or streams for each data type. You get a clean separation of concerns, Security logs go to one stream, File Manager logs to another, without having to write a single conditional routing rule. This partitioning is crucial for performance and for the next phase of the process: analysis.</p>
<h2>Step 3: Significant Events and LLM Analysis</h2>
<p>Once your data is partitioned (e.g., into a dedicated <code>Service Control Manager</code> stream), you can apply GenAI models to analyze the semantic meaning of that stream.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/windows-event-monitoring-with-opentelemetry-and-elastic-streams/llm-analysis.png" alt="LLM analysis of log streams" /></p>
<p>In a traditional setup, the system sees text strings. In an AI-driven setup, the system understands context. When an LLM analyzes the <code>Service Control Manager</code> stream, it identifies what that system is responsible for. It knows that this specific component manages the starting and stopping of system services.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/windows-event-monitoring-with-opentelemetry-and-elastic-streams/significant-events-suggestions.png" alt="Significant events suggestions from AI" /></p>
<p>Because the model understands the <em>purpose</em> of the log stream, it can generate suggestions for what constitutes a &quot;Significant Event.&quot; It doesn't need you to tell it to look for crashes; it knows that for a Service Manager, a crash is a critical failure.</p>
<h3>From Passive Storage to Proactive Suggestions</h3>
<p>The workflow effectively automates the creation of detection rules. The LLM scans the logs and generates a list of potential problems relevant to that specific dataset, such as:</p>
<ul>
<li><strong>Service Crashes:</strong> High severity anomalies where background processes terminate unexpectedly.</li>
<li><strong>Startup/Boot Failures:</strong> Critical errors preventing the OS from reaching a stable state.</li>
<li><strong>Permission Denials:</strong> Security-relevant events regarding service interactions.</li>
</ul>
<p><img src="https://www.elastic.co/observability-labs/assets/images/windows-event-monitoring-with-opentelemetry-and-elastic-streams/significant-events-list.png" alt="List of significant events detected" /></p>
<p>It bubbles these up as suggested observations. You can review a list of potential issues, see the severity the AI has assigned to them (e.g., Critical, Warning), and with a single click, generate the query required to find those logs.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/windows-event-monitoring-with-opentelemetry-and-elastic-streams/query-generation.png" alt="Auto-generated query for significant events" /></p>
<h2>Conclusion</h2>
<p>The combination of OpenTelemetry for standardized ingestion and AI-driven Streams for analysis turns the chaotic flood of Windows logs into a structured, actionable intelligence source. We are moving away from the era of &quot;log everything, look at nothing&quot; to an era where our tools understand our infrastructure as well as we do.</p>
<p>The barrier to effective monitoring is no longer technical complexity. Whether you are tracking security audits or debugging boot loops, leveraging LLMs to partition and analyze your streams is the new standard for observability.</p>
<p><a href="https://cloud.elastic.co/serverless-registration?onboarding_token=observability">Try Streams today</a></p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/windows-event-monitoring-with-opentelemetry-and-elastic-streams/ai-partitioning.png" length="0" type="image/png"/>
        </item>
    </channel>
</rss>