SPLK-1002 Advanced Searching and Statistics Practice Question
Exhibit
Refer to the exhibit. index=web sourcetype=access_combined | rex field=_raw "(?<ip>\d+\.\d+\.\d+\.\d+)" | top ip
The search returns unexpected results, including IP addresses that are not in the expected format (e.g., '127.0.0.1' appears as '27.0.0.1'). What is the most likely cause?
⚠ Common exam trap
Splunk often tests the misconception that `rex` extracts all matches by default, leading candidates to overlook the need for `max_match` or proper regex anchoring when dealing with multiple values in a single event.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
The rex command extracts the first match only; some events may have multiple IPs and the first one is not the full IP.
The `rex` command, by default, extracts only the first match of a regex pattern from each event. If an event contains multiple IP addresses, `rex` captures the first occurrence, which may be truncated if the regex pattern is not anchored properly or if the IP appears in a context where leading digits are separated (e.g., '127.0.0.1' might be preceded by a character that causes the regex to match starting at '27.0.0.1'). This is a common behavior in Splunk when using `rex` without the `max_match` parameter.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The regex pattern is incorrect; it should use \b for word boundaries.
Why it's wrong here
The pattern is correct for matching IPs; \b is optional.
- ✗
The top command is modifying the extracted ip field.
Why it's wrong here
top only counts occurrences; it doesn't modify the field.
- ✗
The rex command must be placed before the index search.
Why it's wrong here
index search runs first; rex is applied to results.
- ✓
The rex command extracts the first match only; some events may have multiple IPs and the first one is not the full IP.
Why this is correct
If the raw contains something like '127.0.0.1' preceded by a digit, the regex might match a subset. But more likely, rex extracts first occurrence; if IP is part of a larger string, it might be incomplete.
Go deeper
Related to this question
About these practice questions
This SPLK-1002 question is part of Courseiva's 475-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This SPLK-1002 practice question is part of Courseiva's free Splunk certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SPLK-1002 exam.