Courseiva
Advanced Searching and StatisticsmediumMultiple ChoiceObjective-mapped

SPLK-1002 Advanced Searching and Statistics Practice Question

Exhibit

Refer to the exhibit.

```
index=web sourcetype=access_combined
| rex field=_raw "(?<method>GET|POST|PUT|DELETE) (?<url>\S+)"
| eval category = case(
    match(url, "^/api/"), "API",
    match(url, "^/images/"), "Images",
    1==1, "Other"
  )
| stats count by category
```

The following search is executed: index=web | rex "GET (?<url>.*)" | eval category=case(url="/api/v1/data","API", url="/login","Login",1=1,"Other") | stats count by category

But it returns unexpected results: the count for 'API' is much lower than expected. What is the most likely cause?

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 regex does not account for the HTTP version string after the URL, causing the URL field to include extra characters like 'HTTP/1.1'.

The most likely cause is that the regex pattern used to extract the URL does not account for the HTTP version string that often appears after the URL, such as 'HTTP/1.1'. This causes the captured URL field to include extra characters like 'HTTP/1.1', which then fails to match the expected patterns in the subsequent eval and stats commands. Option A is incorrect because 'category' is defined in the eval statement using the extracted fields, so it is available after the eval. Option C is incorrect because the case function with a default condition '1==1' is valid and only acts as a catch-all; it would not override earlier conditions if they are true.

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 stats command should use 'count by category' but category is not a field until after eval.

    Why it's wrong here

    Incorrect because 'category' is defined in the eval statement using the extracted fields, so it is available after the eval.

  • The regex does not account for the HTTP version string after the URL, causing the URL field to include extra characters like 'HTTP/1.1'.

    Why this is correct

    Correct. The regex does not account for the HTTP version string after the URL, causing the URL field to include extra characters like 'HTTP/1.1'. This leads to mismatched patterns in the eval and stats commands.

  • The case function has a default condition '1==1' that overrides all other conditions.

    Why it's wrong here

    Incorrect because the case function with a default condition '1==1' is valid and only acts as a catch-all; it would not override earlier conditions if they are true.

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 →

How Courseiva writes practice questions · Editorial policy

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.