# Contextual Log Query Language (CLQL)

These instructions apply to the legacy Admin Console.

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="https://docs.contextual.io/legacy/media/image.png" 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 selected time range for your tenant.
2. Displays the most recent messages at the top

The time-range selector defaults to **Last 24 hours**, but this is a search-window default, not a retention setting. Searchable history is bounded by your tenant's configured retention period: 1, 7, or 30 days. The 1-day tier is the provisioning fallback/default. Selecting a time range that starts before the retained history does not return expired logs.

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="https://docs.contextual.io/legacy/tenants/tenant-logs/contextual-log-query-language-clql/string-searches.md" %}
[string-searches.md](https://docs.contextual.io/legacy/tenants/tenant-logs/contextual-log-query-language-clql/string-searches.md)
{% endcontent-ref %}

{% content-ref url="https://docs.contextual.io/legacy/tenants/tenant-logs/contextual-log-query-language-clql/keyword-searches.md" %}
[keyword-searches.md](https://docs.contextual.io/legacy/tenants/tenant-logs/contextual-log-query-language-clql/keyword-searches.md)
{% endcontent-ref %}

{% content-ref url="https://docs.contextual.io/legacy/tenants/tenant-logs/contextual-log-query-language-clql/advanced-operators.md" %}
[advanced-operators.md](https://docs.contextual.io/legacy/tenants/tenant-logs/contextual-log-query-language-clql/advanced-operators.md)
{% endcontent-ref %}
