Back to exam

SPLK-1004 Cheatsheet

Splunk Core Certified Advanced Power User

Download free PDF

Search execution and performance

Indexes, buckets and search terms

  • **Indexers** locate matching events and perform distributed search work. The **search head** dispatches searches, combines partial results and presents the final results.
  • **tsidx** files contain a term lexicon and posting lists that locate events. A bucket contains raw data and index files; it can contain multiple tsidx files.
  • **Segmentation** breaks raw text into searchable terms using major and minor breakers. Punctuation affects term boundaries; an exact field constraint can require additional event filtering.
  • **Bloom filters** help skip buckets that cannot contain a term. A positive test means possibly present; false positives are possible, while a negative test rules the term out.

Command types and placement

  • **Distributable streaming** commands process events independently and can run on indexers while the preceding pipeline remains distributable. After results move to the search head, later streaming commands run there.
  • **Centralized streaming** commands need a single ordered stream. **Transforming** commands produce statistical tables; supported aggregations can use indexer partial results and a search-head merge.
  • **Generating commands** start a result set. For a small SPL experiment, use **| makeresults | eval greeting="hello"**; makeresults creates one result with **_time** by default.
  • **Optimize early:** restrict index, sourcetype and time; filter before expensive processing; retain only required fields. Avoid moving large raw-event sets to the search head unnecessarily.

Job inspection and subsearch cost

  • **Search Job Inspector** exposes execution costs, job properties and search.log messages. Inspect **remoteSearch** for distributed work and **normalizedSearch** or **litsearch** for search processing clues; **base lispy** describes low-level term logic.
  • An expression **subsearch [ ... ]** runs before the outer search consumes its output. It normally formats returned field values into search predicates; explicitly select the fields that should become constraints.
  • Typical expression subsearch defaults are **60 seconds** and **10,000 results**. Limits depend on the invoking command; append and join have their own result controls. Truncation can change correctness.
  • **append [ search ... ]** adds subsearch rows after the current rows. It is intended for historical searches. Prefer a single search with **stats** and **eval** when it can express the same comparison efficiently.

Statistics, evaluation and result shaping

Choose the right aggregation

  • **stats** replaces events with grouped aggregates. **eventstats** adds group aggregates to the original events. **streamstats** calculates running statistics in input order; sort first when the calculation requires chronological order.
  • **values(field)** returns distinct values in lexicographic order. **list(field)** retains repeated values in event order, subject to configured limits. Both can produce multivalue results.
  • **transaction** groups related events and preserves event context, duration and eventcount. It requires reverse chronological input; use **sort 0 - _time** if earlier commands changed that order.
  • Transaction processing centralizes events and can consume substantial memory. Prefer **stats ... BY session_id** for simple identifier-based grouping; retain transaction when ordered boundaries or event sequences are essential.
  • **fieldsummary** profiles fields rather than sessions. Its output includes count, distinct_count, numeric_count, min, max, mean, stdev and values; use it to inspect field quality and distributions.

Evaluation, nulls and time

  • **eval** calculates fields; **where** filters using evaluation expressions; **fieldformat** changes displayed formatting while preserving the underlying value. Many evaluation functions work in all three.
  • **coalesce(a,b,c)** returns the first non-null argument. An empty string is still a value. **case(isnotnull(a),a,isnotnull(b),b)** can express conditional first-available selection.
  • **typeof(value)** describes the value type, with strings such as **Number**, **String**, **Bool** and **Invalid**. Use isnull, isnum or isstr when the goal is a direct condition.
  • **strftime(epoch,"%H:%M")** formats epoch seconds as text; **strptime(text,format)** parses text to epoch seconds. **_time** is numeric even when the UI displays a date.
  • For recurring clock-hour filtering, use **date_hour>=2 date_hour<5** when those extracted fields represent the intended timezone. Fields include **date_hour**, **date_minute**, **date_mday**, **date_wday**, **date_month**, **date_year** and **date_zone**; there is no standard date_day field.

Multivalue fields and expansion

  • **split(products,",")** returns a multivalue field inside eval: **eval products=split(products,",")**. Alternatively, **makemv delim="," products** splits an existing field.
  • **makemv tokenizer="..." field** uses a regular expression with a capturing group to identify values. The **delim** option supplies a literal delimiter, not a regex.
  • **mvexpand products** makes one result row per product and repeats other fields. **limit** caps values expanded per input row; expansion can greatly increase result count and memory use.
  • **mvcount**, **mvindex**, **mvfilter**, **mvfind**, **mvjoin** and **mvzip** count, select, filter, locate, combine or pair values. mvindex starts at zero; preserve positional relationships when working with parallel JSON arrays.

Reshape, bin and iterate

  • **untable time series value** turns a wide chart-like table into long rows. **xyseries time series value** pivots long rows into a wide table. Duplicate coordinate pairs can lose information; aggregate deliberately first.
  • **bin _time span=5m** groups timestamps into intervals. **span** sets interval width; **bins** requests a maximum number of bins; **minspan** constrains the minimum automatically chosen width.
  • **foreach cpu* [ eval <<FIELD>>=round('<<FIELD>>',2) ]** applies a template to matching fields. **<<FIELD>>** is replaced by each field name; quote substituted field references when needed.

Field extraction, lookups and macros

Structured data and precise extraction

  • **JSON** and **XML** are self-describing formats. **spath** extracts structured paths; with no arguments it attempts automatic extraction from **_raw**. Use **input**, **path** and **output** for a targeted extraction.
  • Repeated JSON array elements can become **multivalue fields**. **multikv** instead parses table-formatted event text, deriving field names from headers and producing an event for each data row.
  • **rex** extracts search-time fields using named capture groups such as **(?<user>...)**. **erex** infers a regex from example values; refine the generated pattern before relying on it.
  • For a persistent extraction, save a **Field Extractor** definition and review its regex, permissions and sourcetype scope. Prefer specific character classes and bounded patterns; avoid unnecessary **.***, ambiguous nesting and excessive backtracking.

Lookup storage and matching

  • **lookup** enriches events using matching key fields. **inputlookup** reads lookup rows as results. Use **OUTPUT** to assign output fields or **OUTPUTNEW** to avoid replacing existing destination fields.
  • **CSV** lookups suit static tables. **KV Store** collections hold records with a unique **_key** and application fields; define the collection and lookup definition, then map event fields to lookup keys.
  • **External lookups** invoke a configured Python script or supported executable. **Geospatial lookups** use **KML/KMZ** feature definitions; match coordinates to geographic features with the configured geospatial lookup.
  • **min_matches** sets the required match count; when positive and unmet, **default_match** supplies padding values. **max_matches** caps returned matches. **time_field** makes a lookup time-bounded.
  • To exclude a small lookup list, use **NOT [ | inputlookup baditems.csv | fields item ]** with an event field of the same name. For large lists, enrich with a match flag and filter it to avoid expression subsearch limits.

Reusable and nested macros

  • Invoke a **search macro** by enclosing its name in **backtick characters**; use **name(value)** inside the backticks to pass an argument. Definitions can call other macros; create and test dependencies before their callers.
  • A macro argument is substituted using **$argument$** in its definition. An outer macro can forward that argument explicitly through an inner call, with **inner($argument$)** enclosed in backticks.
  • If expansion starts with a generating command, put the required **leading pipe** before the macro invocation. Verify the expanded SPL syntax, including any nested generating command.
  • **Search preview** expands macros, including nested calls, so you can inspect the complete SPL before execution. Check quoting, argument validation and knowledge-object sharing as well as the macro text.

Summary data and search acceleration

Choose an acceleration strategy

  • **Report acceleration** maintains summaries for an eligible saved transforming search. Commands before its first transforming command must be streamable, and event sampling disqualifies it.
  • **100,000 events** concerns creation of an eligible report's hot-bucket summary, not a requirement for 100,000 output rows. Summary range and available summary coverage affect the performance benefit.
  • **Data model acceleration** maintains reusable indexed summaries for eligible data model datasets. Choose it when several searches can reuse the same modeled fields and constraints.
  • **Summary indexing** writes scheduled aggregate results to a separate index. It provides flexibility for searches that do not fit automatic acceleration; plan retention, schedule windows, late data and backfill without double counting.

Read summaries correctly

  • **tstats** aggregates indexed fields from **tsidx** files, including accelerated data model summaries. Arbitrary search-time extractions are not automatically available as indexed fields.
  • For accelerated data models, **summariesonly=true** uses only summarized data and can omit recent or uncovered data. **summariesonly=false** also searches the unsummarized portion, trading speed for fuller coverage.
  • Use explicit field names in **tstats** functions and **BY** clauses. Wildcards are supported in suitable **WHERE** field-value predicates, not as arbitrary aggregate or grouping field-name patterns.
  • **sistats**, **sichart**, **sitimechart**, **sitop** and **sirare** prepare mergeable summary records. A scheduled producer such as **sistats count BY productId** must also be configured to write to the summary index.
  • Read generated summaries with the corresponding normal aggregation. For **sitop** output, select **index=summary search_name="Linux logins"** and use **top src_ip user**; do not count summary rows as if each were a raw event.

Classic dashboards, drilldowns and alerts

Simple XML and shared searches

  • Classic **Simple XML** uses a **dashboard** or **form** root, then **row**, **panel** and visualization elements such as **chart** or **table**. A form adds inputs, commonly inside **fieldset**.
  • An **inline search** belongs to its panel or visualization. A **base search** has an **id**; a post-process search references it with **base="base_id"** and applies its query to the base results.
  • Define **<search id="base_id"><query>...</query></search>**, then use **<search base="base_id"><query>stats sum(count) BY host</query></search>** in a panel. The base must retain every required downstream field.
  • **Shared base searches** reduce duplicate dashboard work. Prefer a suitable transforming base; post-processing cannot recover fields removed upstream. Refreshing the base updates its dependent post-process panels.

Inputs, tokens and event actions

  • An input publishes a **token** consumed as **$token$** in search text, titles or other supported properties. A time input supplies **$time.earliest$** and **$time.latest$** for a token named time.
  • **Cascading inputs** use one input token to filter the choices of another. Reset downstream selections through a **change** handler when their parent choice changes.
  • Event actions are **<set>**, **<unset>**, **<eval>** and **<link>**. Set publishes a value, unset removes a token, eval computes a token value and link navigates to a destination.
  • **sourcetype=$click.value|s$** quotes and escapes a clicked value for SPL. **|u** encodes a URL value; **|h** escapes HTML. Token filters match the destination context.

Drilldown and contextual detail

  • **Dynamic drilldown** passes clicked data to another dashboard or page; **contextual drilldown** uses clicked data to update or reveal detail within the current dashboard. A static link always uses a fixed destination.
  • Predefined tokens depend on visualization type. **$click.name$** and **$click.value$** describe the click; a table row field uses **$row.fieldname$**, for example **$row.host$**.
  • Use **<drilldown><link>...</link></drilldown>** for navigation. Pass multiple form inputs as URL parameters such as **?form.host=$row.host
    amp;amp;form.user=$row.user$**; XML requires **&amp;** between query parameters.
  • **depends** shows an element when all listed tokens are defined. **rejects** hides it when any listed token is defined. Lists are comma-separated; these attributes control display, not authorization.
  • Configure a visualization's drilldown behavior explicitly. A click may open Search, follow a custom link or update tokens; it does not inherently refresh every dashboard panel.

Annotations, diagnostics and alert actions

  • A chart annotation search uses **<search type="annotation">** and must return **_time**. Optional **annotation_label**, **annotation_category** and **annotation_color** add text, grouping and color.
  • List custom CSS files in the root **stylesheet="base.css,detail.css"** attribute. Store app assets under **appserver/static**. The panel option **link.inspect.visible=false** hides its Inspect link.
  • Troubleshoot a panel by running its expanded search independently, checking the **Search Job Inspector** and search.log, and temporarily displaying token values in an **HTML panel**. Check unset tokens, time ranges and base fields.
  • A lookup can be part of the SPL saved as an **alert**. **Log Event** writes an event to an index and requires appropriate capabilities; **edit_tcp** is relevant to this action. A role name alone does not prove effective access.
  • A **webhook alert action** sends an HTTP POST payload to a configured endpoint. The receiving service can create a ticket or chat message; a webhook action is not a general-purpose web-page retrieval command.