---
title: Patterns and facets
description: Group log lines by message template with patterns, and break results down by service, environment, level, type and attributes with facets.
url: https://docs.zevsight.com/explore/patterns-and-facets
---

# Patterns and facets

> Group log lines by message template with patterns, and break results down by service, environment, level, type and attributes with facets.

## Patterns

The **Patterns** tab (press `t`) groups log lines whose messages differ only in their variable parts. It answers "what kinds of lines are these?" faster than scrolling.

Varying parts become placeholders:

| Placeholder | Replaces |
|---|---|
| `<uuid>` | UUIDs |
| `<time>` | Timestamps |
| `<email>` | Email addresses |
| `<ip>` | IP addresses |
| `<str>` | Quoted strings |
| `<n>` | Numbers, with an optional short unit such as `ms` or `%` |
| `<hex>` | Runs of 8 or more hex characters |

So `payment provider timeout after 3 retries` and `… after 5 retries` share the pattern `payment provider timeout after <n> retries`.

Each pattern shows its count, a breakdown by level, first and last seen, and the newest sample line. Click a pattern to filter to it (its longest literal part is added as a phrase), or use the eye button to exclude it.

- Only `log` events with a message are grouped.
- Grouping uses the newest 200,000 matching lines in the range. When there were more, the result is marked as sampled.
- The API is [`GET /v1/query/patterns`](/api/reference/query#patterns), with up to 500 patterns per call.

## Facets

Press `f` to open facets. They show value counts for the current search:

- **Fields:** project, environment, service, severity (level) and type. These counts are exact.
- **Attribute and resource keys:** the most common keys in the matching lines, counted over the newest 100,000 matching lines (marked as sampled when there were more).

Click a value to include it, or `⌥`-click (or **−**) to exclude it. Project and environment clicks change the scope; other values add query terms.

For a single field or attribute, the API [`GET /v1/query/facets/values`](/api/reference/query#facet-values) returns its top values, optionally by `prefix`. That is useful for autocomplete or "show more".
