SPLK-1001 eval case function Practice Question
Exhibit
Refer to the exhibit. Search: index=main | eval priority = case(error = "critical", 1, error = "warning", 2, 1=1, 3) | stats count by priority Results show priority values 1, 2, and 3. What would happen if the eval statement was changed to: eval priority = case(error = "critical", 1, error = "warning", 2, true(), 3)?
Refer to the exhibit. What would happen if the eval statement was changed to: eval priority = case(error = "critical", 1, error = "warning", 2, true(), 3)?
⚠ Common exam trap
Candidates often mistake `=` for `==` in eval expressions. In `case`, `=` performs assignment and always yields a truthy value, so the first condition always matches. The trap is believing the search results remain the same; in reality, all events receive priority 1, altering the intended output.
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
✓
All events are assigned priority 1
Using assignment `=` instead of comparison `==` in the `case` function causes each condition to evaluate as an assignment. In Splunk eval, assignment returns the assigned value, which is truthy for non-empty strings. The first condition `error = "critical"` is always true, so the first branch is taken for every event, setting `priority=1`. Consequently, the search returns results where every event has priority 1, which differs from the original output where priorities varied. No syntax error occurs.
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 search returns no results
Why it's wrong here
No reason for no results.
- ✓
All events are assigned priority 1
Why this is correct
true() functions similarly to 1=1 as a catch-all.
- ✗
The search only returns priority 3
Why it's wrong here
The conditions for 1 and 2 still apply.
- ✗
The search returns a syntax error
Why it's wrong here
true() is a valid eval function.
Go deeper
Related to this question
About these practice questions
One of 502 original SPLK-1001 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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-1001 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-1001 exam.