# Contextual Clustering

{% hint style="info" %}
This is an older version of the document. To view the most recent version of the document, click [here](https://docs.opsmx.com/products/data-and-intelligence-module-autopilot/autopilot/log-analysis/contextual-clustering).
{% endhint %}

Through contextual clustering, we enhance diagnosis by providing the following:

1. A view of the error log and its surrounding log lines.
2. Automated grouping of error patterns based on the patterns of logs seen around the error (as same error can occur in different contexts).
3. Stores the previously seen error patterns along with its metadata (tags and comments that a user may want to assign to that error pattern) for easier diagnostics in future runs.&#x20;

In the current ‘**Unexpected**’ tab of log analysis, every cluster is formed using an algorithm which estimates the closeness between log lines and grouping them together.<br>

Sample normal cluster 1

![](https://lh4.googleusercontent.com/-OPLPIbH2P07SWkHd8jz6mycZ1AbD3n9N9RH4zTa7BlK2hovcVrX1U5v8TIhfS1GwiES13YqePxCs-f0tQ-M3IdeAmhoZCfRCgK27a-J4VdD8C5q7fFqLMPh10pduju75nJbEkkF)

Sample normal cluster 2

![](https://lh5.googleusercontent.com/yJrhYBF5pfwLJx4nrD_5-bndmSEDk34nDVPMe-1uwrAQhQzN2DerLkbxlzo9twLD3ZD8b5cTHG6g6U9iNe1htljhZ-5zwaqWzrmagSNRI5Nf5hXVnn5OlTVjK_yBP1Qs9ZA99VCg)

These clusters do not provide any detail about why or how a ‘Critical Error’, ‘Error’ and ‘Warning’ events occur.  <br>

Let's take a look at the first cluster ‘FileNotFoundException’. It has occurred once which is indicated by the new release count.

![](https://lh6.googleusercontent.com/ChGac-zecAWlpLfk7UjULsbc9rCIbIDEQgRkMwi6cJhKM0pJK6e0U3wMdQXsCqOsDe8Yccfba-FT4KOBASYnYH2LokxpOjW8Z5vEJlcljslmkkgQSYujFVPjJJAHG5lH5X9Ga5GE)

To see the context of this log line, navigate to the ‘Contextual’ tab and check for the same error log line. It will be as below:

![](https://lh5.googleusercontent.com/_KEbsyRFw5sVg88rpJdbe7KxGv_XMZqcEpNQUEhdoa8sRD04WyTHoQbOOzP2buvu-h5xooSUcIX_ESqYr7Y4OwM2iI8cB6M4Q4tsaTw1YpiKt9dzj_ZVAFBAS70VxyrJ6fwdaBt9)

Click on the ‘Show More’ button to display the entire context based on the window size provided earlier. Refer to the image below:

&#x20;

![](/files/-M_KXXhfbygpcEH6viRI)

The details will appear as shown in the image below:

![](/files/-M_KXjW_dCZcVNI-peMO)

Now let's take a look at the second cluster which is ‘**No servers found from any supplier**’. For this same error log, note that it occurs in two different patterns as shown below:<br>

![](/files/-M_KYGuXwd9gDRmoE_Y9)

Click the ‘Show More’ button will display the entire context based on the window size provided earlier as shown below:

![](/files/-M_KYf_JYgKPjBubn2tX)

When a pattern is repeated more than once a line is used to distinguish the occurrences of the pattern as below:<br>

![](/files/-M_KYvHtx0x_Z2pHJDjN)

You can also add an already present tag or create a new one in the ‘Contextual’ tab using the Tag drop-down as shown below:&#x20;

![](/files/-M_KZFD8BtpR05Vgh7Vt)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.opsmx.com/opsmx-1/opsmx-context-engine/additional-resources/previous-releases/isd-3.10/data-and-intelligence-module-autopilot/continuous-verification/log-analysis/contextual-clustering.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
