SPLK-1001 Using Fields and Lookups Practice Question
A user wants to create a field that contains the length of the 'message' field. Which command should they use?
⚠ Common exam trap
Splunk often tests the distinction between functions that must be used within `eval` versus standalone commands, and candidates mistakenly treat `len()` as a standalone command like `rex` or `stats`.
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
✓
eval msg_length=len(message)
The `eval` command in Splunk is used to create or modify fields, and the `len()` function returns the character length of a string field. The syntax `eval msg_length=len(message)` creates a new field named `msg_length` containing the length of the `message` field.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
rex field=message "(?<msg_length>.*)"
Why it's wrong here
rex extracts, not calculates length.
- ✗
eval msg_length=sizeof(message)
Why it's wrong here
sizeof does not exist in Splunk.
- ✗
len(message)
Why it's wrong here
len is a function, not a command.
- ✓
eval msg_length=len(message)
Why this is correct
Correct way to compute length.
Go deeper
Related to this question
About these practice questions
This SPLK-1001 question is part of Courseiva's 502-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-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.