Skip to content

Query Language Overview

View as markdown

WireLog queries use a pipe-composed DSL. A source selects the data; stages transform it.

source | stage | stage | ...

Every query starts with a source (what data), then zero or more stages separated by | (how to filter, aggregate, sort).

Sources

SourceSyntaxDescription
Event<event_name> or "<event_name>"Filter by event_type
All events*All event types (leading | also works)
Funnelfunnel a -> b -> cMulti-step conversion analysis
Retentionretention <event>Cohort retention over time
Pathspaths from <event>User flow analysis
SessionssessionsSession-level analytics
Lifecyclelifecycle <event>New/returning/resurrected/dormant status
Stickinessstickiness <event>Active-days distribution
User timelineuser "<id>"Single user’s events (quoted)
Users directoryusersQuery user profiles table
Formulaformula count(a) / count(b)Computed metrics across event types
FieldsfieldsDiscover available fields (system + dynamic property keys)

See Sources for full reference.

Stages

StageSyntaxDescription
Filter| where field = "value"Filter rows by condition
Time range| last 7d, | from ... to ..., | today, | this monthRestrict time window
Count| count, | count by dayCount events, optionally grouped
Unique| unique distinct_idCount unique values
Sum / Avg| sum event_properties.amountNumeric aggregations
Min / Max| min field, | max fieldExtremes
Median / Percentiles| median field, | p90 field, | p95 field, | p99 fieldDistribution
Group by| count by day, fieldGroup aggregation by time or field
List| listReturn raw event rows
Window| window 7dFunnel/path completion window
Depth| depth 8Path depth limit
Sort| sort field descOrder results
Limit / Top| limit 100, | top 20Cap result count

See Stages for full reference.

Request format

Send queries via POST /query with a secret key (sk_) or access token (aat_ with query scope):

{
"q": "signup | last 7d | count by day",
"format": "llm",
"limit": 100,
"offset": 0
}
FieldRequiredDefaultDescription
qYesQuery DSL string
formatNollmOutput format: llm (Markdown), json, csv
limitNo100Max rows returned (max 10,000)
offsetNo0Pagination offset

Auth header: X-API-Key: sk_... or X-API-Key: aat_...

Quick examples

# Daily signups this week
signup | last 7d | count by day
# Special-character event source
landing:cta_click | last 7d | count
"landing:cta_click" | last 7d | count
# Conversion funnel
funnel signup -> activate -> purchase exclude support_ticket | last 30d | window 7d
# Weekly retention cohorts
retention signup | last 90d
# Session attribution trend
sessions | last 30d | count by session.utm_source
# Path allowlist (JSON-style list literal)
page_view | where _path in ["/","/pricing","/docs"] | last 7d | count
# All events from a specific company
* | where user.email_domain = "acme.org" | last 30d | count by event_type
# Backend spend by latest browser-region context
ai_usage_charged | where user_last_session.region = "DE" | last 30d | sum event_properties.amount
# Single user timeline
user "alice@acme.org" | last 90d | list
# Conversion rate as a ratio
formula count(purchase) / count(signup) | last 30d

Output formats

llm (default) — Markdown table. Designed for LLM consumption. Includes column headers and aligned rows.

json — Array of objects. Each row is a JSON object with column names as keys.

For aggregate-style rows in JSON, use:

  • value as the canonical numeric metric output
  • metric as the metric identifier (count, unique, sum, avg, etc.)

Legacy metric keys (count, unique_count, total, …) are retained for compatibility.

csv — Comma-separated values with header row.

Next

  • Sources — event, funnel, retention, paths, sessions, lifecycle, stickiness, user, users, formula, fields
  • Stages — where, time ranges, aggregations, sort, limit
  • Fields — core, system, properties, profile fields, identity
  • Examples — 15+ annotated real-world queries