Skip to content

rare

import { Aside } from ‘@astrojs/starlight/components’;

The rare command finds the least common values (or combinations of values) for the specified fields. It is the inverse of top — instead of returning the most frequent values, it returns the least frequent. Results are sorted from least to most common.

rare is a powerful tool for anomaly surfacing. In observability data, uncommon values often signal problems: a rare error type, a service name that only appeared recently, or an unusual status code can all indicate issues that deserve investigation.

rare [rare-options] <field-list> [by <group-field>]
ArgumentRequiredTypeDefaultDescription
<field-list>YesComma-delimited field namesThe fields to find rare values for. When multiple fields are specified, rare finds the least common combinations.
by <group-field>NoField name(s)One or more fields to group the results by. Rare values are computed separately within each group.
showcountNoBooleantrueWhen true, includes a count column showing the frequency of each value. Set to false for cleaner output.
countfieldNoStringcountThe name of the count column in the output. Only applies when showcount=true.
  • Anomaly surfacing. Rare values in observability data are often signals: a rare error type, a service that barely produces logs, or an unusual severity level can all indicate issues.
  • Rare error types. Use rare on error message fields to find unusual errors that might be masked by high-volume common errors.
  • Rare service names. A service that appears rarely in logs might be failing to start, experiencing intermittent connectivity, or newly deployed.
  • Rare status codes. Uncommon HTTP status codes or gRPC error codes can reveal edge cases in your application logic.
  • Use by clause for per-group rare values. Find what is unusual within each group — for example, the rarest severity level per service.
  • Returns up to 10 results. The rare command returns at most 10 results per group-by combination. Unlike top, there is no parameter to increase this limit.

Find the least common log severity levels across all services:

| rare severityText

Try in playground →

Find the services that produce the fewest logs — these may be failing or newly deployed:

| rare `resource.attributes.service.name`

Try in playground →

Find the rarest severity levels within each service. A service that rarely produces ERROR logs suddenly showing them is noteworthy:

| rare showcount=false severityText by `resource.attributes.service.name`

Try in playground →

Return just the rare values without frequency counts:

| rare showcount=false severityText

Try in playground →

Use a custom name for the count field:

| rare countfield='occurrences' `resource.attributes.service.name`

Try in playground →

Rare service-severity combinations in OTel logs

Section titled “Rare service-severity combinations in OTel logs”

Find unusual combinations of service and severity level. Combinations that appear rarely may indicate new failure modes:

| rare `resource.attributes.service.name`, severityText

Try in playground →

Find the least frequently executed operations in each service from trace data. Rare operations can indicate code paths that are only hit under unusual conditions — potential sources of untested behavior:

source = otel-v1-apm-span-*
| rare name by serviceName

This is especially useful after a deployment: if a new operation name appears in rare output that was not there before, it may indicate new functionality or an unexpected code path being triggered.

  • top - The inverse of rare: find the most common values
  • dedup - Deduplicate to get unique values with sample documents
  • stats - For more detailed frequency analysis with custom aggregations
  • patterns - Automatically discover and cluster log patterns
  • PPL Command Reference - All PPL commands