# Contextual Log Query Language (CLQL)

Available to users in tenants which are on subscription plans that support advanced Agent Log features, the Contextual Log Query Language (CLQL) is a powerful and flexible way to search, filter, and isolate the details you need across Agent Message Logs to gain insights into your tenant's activities.

To get started:

1. Go to **Logs → All Logs** in your tenant, which will default to the Messages tab
2. Enter your query in CLQL Query Editor in the top right of the screen and press Enter or click Search to perform your query\\

   <figure><img src="/files/klIk8tuR9ZRsHCCvzoQL" alt=""><figcaption><p>CLQL Query Editor</p></figcaption></figure>

***

## Search Basics

CLQL’s search syntax uses a **pipeline** concept. By default, CLQL:

1. Pulls all log messages from the last 24 hours for your tenant
2. Displays the most recent messages at the top

To narrow your search, add **keywords** and **operators** to refine your results until you find exactly what you need.

***

## Getting Started

Inside the editor (**Logs → All Logs - Message Tab**), a typical search query looks like this:

```graphql
keyword search | where | sort | limit
```

1. **Select a Time Range** from the drop-down (defaults to “Last 24 hours”)
2. Enter a simple key term (e.g. `error`) to match any messages containing that term in any field value
3. Press **Enter** or click **Search**
4. Contextual returns all log messages matching your search query in the **Messages** tab below

**Tip:** All queries should begin with a string or keyword search. You can combine multiple searches with spaces. If your query gets long, use *soft returns* (line breaks) to make it more readable.

## String, Keyword, and Advanced Operator Searches

Dig into the details of String Searches, Keyword Searches, and Advanced Operators.

{% content-ref url="/pages/34na1ygywLQSspWPUObl" %}
[String Searches](/documentation-and-resources/tenants/tenant-logs/contextual-log-query-language-clql/string-searches.md)
{% endcontent-ref %}

{% content-ref url="/pages/iVfgXYJpTfVepUGRzrtZ" %}
[Keyword Searches](/documentation-and-resources/tenants/tenant-logs/contextual-log-query-language-clql/keyword-searches.md)
{% endcontent-ref %}

{% content-ref url="/pages/CLRexX93LyLt51Q49GK6" %}
[Advanced Operators](/documentation-and-resources/tenants/tenant-logs/contextual-log-query-language-clql/advanced-operators.md)
{% endcontent-ref %}


---

# 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.contextual.io/documentation-and-resources/tenants/tenant-logs/contextual-log-query-language-clql.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.
