6.2 The rare Command
Key Takeaways
- rare is the inverse of top: same options and defaults, but it returns the least frequent field values.
- Default limit is 10; count and percent appear by default just as they do for top.
- Use rare for uncommon errors, unusual users, sparse status codes, or outlier combinations.
- rare is still transforming—results appear as a Statistics table, not a long Events list.
- Do not use rare when you need sums, averages, or distinct counts—those belong to stats.
6.2 The rare Command
Quick Answer:
| rare <field>finds the least common values of a field. It uses the same options astop(default limit=10, plus count and percent). Chooserarewhen the exam question is about uncommon or outlier values—not averages or most-frequent rankings.
Topic 5.2 The rare command sits beside top in Domain 5.0 (15%). Splunk’s own reference states that rare operates identically to top, except it returns the least frequent values instead of the most frequent. If you already understand top, rare is mostly a direction flip—but the exam still tests whether you pick the right direction.
Why uncommon values matter
Operations and security workflows often care about rarity:
- Status codes that almost never appear may signal a new failure mode
- Usernames that show up once may be misconfigurations or probing
- Hosts that barely send a sourcetype may be offline or mis-forwarding
- Method/URI pairs seen once may be exploratory attacks or broken clients
top answers “what dominates?” rare answers “what barely shows up?” Both are frequency tools; neither replaces stats for sums and averages.
Syntax (same family as top)
... | rare [<options>] <field-list> [BY <field-list>]
Example:
index=web sourcetype=access_combined
| rare status
You get the least common status values (default ten), each with count and percent.
Shared with top | Behavior for rare |
|---|---|
limit=<int> | How many rarest tuples to keep (default 10) |
showcount / showperc | Toggle count/percent columns (default on) |
countfield / percentfield | Rename those columns |
| Multiple fields in the field list | Rank rare combinations |
BY clause | Rarest values per group |
index=security
| rare limit=20 user BY action
This returns, for each action, up to twenty least common user values among events that reached the command.
Comparing top and rare side by side
| Question the user asks | Command |
|---|---|
| Which referers drive most traffic? | top referer |
| Which referers appear almost never? | rare referer |
| Top 5 error codes overall | top limit=5 status (often after filtering to errors) |
| Five scarcest error codes | rare limit=5 status |
| Per-host scarcest URIs | rare uri_path BY host |
Exam wording cues:
- most / common / frequent / popular / busiest → lean
top - least / rare / uncommon / infrequent / unusual → lean
rare - average / sum / distinct / min / max → lean
stats
Worked troubleshooting scenarios
Scenario A — sparse HTTP statuses
index=web earliest=-7d
| rare limit=15 status
If almost all traffic is 200/304, rare surfaces odd codes (418, 451, custom app codes) that top would bury beneath the popular ones.
Scenario B — uncommon users failing login
index=auth action=failure
| rare limit=10 user
Here “rare” among failures means users who failed infrequently in the filtered set—useful when you already scoped to failures and want sparse usernames, not the noisiest attackers (top user would show those).
Scenario C — rare combinations
index=web
| rare limit=5 method, status
A combination like DELETE + 500 may be rarer (and more interesting) than either field alone.
Result shape and UI expectations
Like top, rare is a transforming command:
- Primary readable output is a Statistics table
- Default columns include the field(s) you named plus count and percent
- Percent is still relative to events that entered
rare, after prior filters
| Expectation | Correct? |
|---|---|
rare returns least frequent values | Yes |
| Default returns 10 rows (unless limit changes) | Yes |
| You still get count and percent by default | Yes |
rare is the command for average response time | No — use stats avg(...) |
After rare, Events tab shows the original millions of raw rows as the main answer | No — you are looking at aggregated rare-value stats |
Briefly: charting those rare-value tables comes later when you save reports/visualizations. Domain 5.2 tests that you can produce the rare-value table, not design a dashboard.
Limits and “all rare values”
limit=0 on this command family asks Splunk to return all qualifying tuples up to the configured maximum (documented ceiling tied to maxresultrows / limits settings). On the User exam, you rarely configure limits.conf; just know:
- Default presentation is 10
- You can raise or lower with
limit= - Extremely large limits are a memory/performance concern in real life—even if the exam only asks what the option does
Common traps
- Picking
rarewhen the stem says “most common.” Mirror-image mistakes are frequent on multiple-choice exams. - Thinking
raremeans “events with rare=true.” There is no such default field;rareis a command. - Using
rareinstead of a filter. If you only wantstatus=500, filter first (status=500).rareranks uncommon values; it does not mean “only error events.” - Forgetting BY scope.
| rare user BY hostis not the same as a global| rare user. - Assuming rare values are always security incidents. Rarity is a signal, not a verdict—exam answers stay at the SPL behavior level.
Decision tree for Domain 5.1–5.2
- Need frequency ranking of field values? →
toporrare - Most vs least? → choose direction
- Need a number of rows other than 10? → set
limit - Need per-category rankings? → add
BY - Need math beyond frequency (sum/avg/dc)? → leave this pair and use
stats
Internalize that tree and 5.2 questions reduce to reading the adjective in the stem (least vs most) and matching options.
Which statement correctly describes the relationship between the rare and top commands?
An analyst wants the 20 least common clientip values among web events. Which SPL best matches that request?
When is rare a better fit than stats for a User-level task?