# Contextual Log Query Language (CLQL)

These instructions apply to the current 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. In the left navigation, under **Operate**, select **Logs**. The **Messages** tab is selected by default.
2. Enter your query in the CLQL editor at the top of the page, then press **Enter** or select **Run query**.

***

## 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 default retention tier is 1 day. 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

On the **Logs** page (**Messages** tab), a typical search query looks like this:

```text
error
| where _instance = http*
| sort by _createdAt desc
| limit 100
```

Put each pipe stage on its own line. Press **Shift+Enter** to add a line without running the query.

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 select **Run query**
4. Contextual returns all log messages matching your search query in the **Messages** tab below

**Tip:** Combine string searches or keyword predicates with spaces to require all terms. Use a new line for each `| where`, `| sort by`, or `| limit` stage.

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

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

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