Courseiva
Question 501 of 502
Using Fields and LookupsmediumMultiple ChoiceObjective-mapped

SPLK-1001 Using Fields and Lookups Practice Question

An analyst wants to compute the average response time for each server from web server logs. The field `response_time` is a string like '120ms'. What is the correct way to convert and compute?

⚠ Common exam trap

Many candidates assume `replace` alone makes a field numeric, forgetting that Splunk treats the result as a string until an explicit arithmetic operation (like `*1` or `tonumber()`) forces type conversion.

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 response_num=replace(response_time, "ms", "") | eval response_num=response_num*1 | stats avg(response_num) by server

It first uses `replace` to strip the 'ms' suffix from the string field `response_time`, then multiplies the resulting string by 1 (`response_num*1`) to coerce it into a numeric type. Only after conversion can `stats avg(response_num) by server` compute a meaningful average. Without the numeric coercion, Splunk would treat the field as a string and either fail or produce incorrect results.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • eval response_time=response_time + "0" | stats avg(response_time) by server

    Why it's wrong here

    Adding a string does not convert to numeric; avg will fail.

  • eval response_num=replace(response_time, "ms", "") | eval response_num=response_num*1 | stats avg(response_num) by server

    Why this is correct

    Replace removes 'ms', and multiplying by 1 converts to numeric, then avg works.

  • eval response_num=replace(response_time, "ms", "") | stats avg(response_num) by server

    Why it's wrong here

    Replace returns a string, so avg will treat it as a string with unpredictable results.

  • eval avg_response=avg(response_time)

    Why it's wrong here

    Avg requires numeric fields; string fields cause errors or unexpected results.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jul 4, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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.