SPLK-1002 Macros, Saved Searches and CIM Practice Question
Which TWO of the following are valid ways to define arguments in a Splunk macro?
⚠ Common exam trap
Splunk often tests the distinction between named placeholders ($arg1$) and positional placeholders ($1$), leading candidates to mistakenly think positional placeholders are valid in Splunk macros when they are not.
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
✓
In the macro definition, use $arg1$, $arg2$ as placeholders for the arguments.
Splunk macros use named placeholders like $arg1$, $arg2$ in the macro definition to represent arguments. When the macro is invoked, these placeholders are replaced with the actual values passed by the user, allowing flexible and reusable search snippets.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
In the macro definition, use $arg1$, $arg2$ as placeholders for the arguments.
Why this is correct
Correct. $arg1$, $arg2$ are the standard positional placeholders.
- ✓
Arguments are defined by listing them in the 'args' attribute in macros.conf.
Why this is correct
Correct. The 'args' field specifies the list of argument names.
- ✗
In the macro definition, use $1$, $2$ as positional placeholders.
Why it's wrong here
Incorrect. Splunk does not support $1$, $2$ placeholders in macros.
- ✗
Arguments are automatically inferred from the search string in the macro definition.
Why it's wrong here
Incorrect. Arguments must be explicitly defined; they are not inferred.
- ✗
In the macro definition, use named placeholders like $error_code$.
Why it's wrong here
Incorrect. Named placeholders are not supported; only $arg1$, $arg2$ are used.
Go deeper
Related to this question
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 →
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.