- Investigate spikes or dips in a time series and want to know what changed
- Explain why a subset of traces is slow or error-prone
- Find which attributes distinguish suspicious requests from normal traffic
For users of other query languages
If you come from other query languages, this section explains how to adjust your existing queries to achieve the same results in APL.Splunk SPL users
Splunk SPL users
In Splunk, there is no one operator that compares a selected cohort to the baseline across many fields at once. You often create a flag with
eval
, run separate stats
/eventstats
for each field, and then appendpipe
or join
to compare rates. In APL, spotlight
is an aggregation you call once inside summarize
. You pass a Boolean predicate to define the cohort and a list of fields to inspect, and APL returns a scored table of differences.ANSI SQL users
ANSI SQL users
Standard SQL does not include a built-in cohort-vs-baseline comparator. You typically
CASE
a selection flag, aggregate twice (selected vs baseline), compute proportions, deltas, and significance, then union and sort. In APL, you express the selection as a predicate and let spotlight
compute proportions, lift, and scores for each field/value.Usage
Syntax
spotlight
inside summarize
. The first argument defines the comparison set. The remaining arguments list the fields to analyze.
Parameters
Name | Type | Description |
---|---|---|
SelectionPredicate | Boolean expression | Defines the comparison set (selected cohort). Spotlight compares events where the predicate evaluates to true against the baseline (events where it evaluates to false ) within the current query scope. |
Field1 ... FieldN | field references | One or more fields to analyze. Include string or categorical fields (for proportions) and numeric or timespan fields (for distributional differences). |
Returns
- Bar charts for categorical fields (strings, Booleans)
- Boxplots for numeric fields (integers, floats, timespans) with many distinct values
Use case examples
Find what distinguishes error responses from normal traffic in the last 15 minutes.QueryRun in PlaygroundThis query keeps the last 15 minutes of traffic in scope and compares error responses to everything else. Spotlight ranks the strongest differences, pointing to endpoints, regions, and latency ranges associated with the errors.
Best practices
- Keep the
where
scope broad enough that the baseline remains meaningful. Over-filtering reduces contrast. - Pass only fields that carry signal. Very high-cardinality identifiers can drown out more actionable attributes.
- Include numeric fields like
req_duration_ms
orduration
to let Spotlight detect distribution shifts, not just categorical skews.
List of related functions
- where: Filters events before Spotlight runs. Use it to scope the time window or dataset; use
spotlight
to compare selected vs baseline inside that scope. - summarize: Runs aggregations over events.
spotlight
is an aggregation you call withinsummarize
. - top: Returns the most frequent values. Use
top
for simple frequency counts; usespotlight
to contrast a cohort against its baseline with lift and significance. - lookup: Enriches events with reference attributes. Use
lookup
to add context before runningspotlight
across enriched fields.