SPLK-1002 Macros, Saved Searches and CIM Practice Question
A Splunk administrator wants to create a reusable search component that accepts a sourcetype and a time range. What is the correct method to define this in Splunk?
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
✓
Define a macro with arguments using backticks and $arg$ syntax.
The correct method is to define a macro with arguments using backticks and $arg$ syntax (Option C). Macros are designed for reusable search components that can accept parameters. Option A (saved search with tokens) is typically used in dashboards to pass values at runtime, not for creating reusable search fragments. Option B (eval statement) defines a variable but does not create a reusable search component. Option D (lookup definition) is used for enriching events with external data, not for defining search logic.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Create a saved search that uses tokens to parameterize the query.
Why it's wrong here
Tokens are used in dashboards, not for search-time macro expansion.
- ✗
Use an eval statement to define a variable that holds the query.
Why it's wrong here
Eval defines fields or variables within a search, not reusable search components.
- ✓
Define a macro with arguments using backticks and $arg$ syntax.
Why this is correct
Macros with arguments allow a reusable search fragment with parameter substitution.
- ✗
Use a lookup definition with parameters to filter results.
Why it's wrong here
Lookups are for enriching data, not for defining search logic.
Go deeper
Related to this question
About these practice questions
Courseiva writes every SPLK-1002 question from scratch — 475 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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.