SPLK-1002 Macros, Saved Searches and CIM Practice Question
A large organization uses Splunk to monitor its network infrastructure. They have a single saved search that runs every hour to create a summary index for each of the 50 network device sourcetypes. The saved search uses a macro named `build_network_summary` that accepts two arguments: `sourcetype` and `time_range`. The macro definition is:
```
[build_network_summary]
definition = index=network sourcetype=$sourcetype$ earliest=$time_range$ latest=now | stats count by src_ip, dest_ip, protocol | collect index=network_summary args = sourcetype, time_range iseval = 0 ```
The saved search iterates over the 50 sourcetypes using a separate lookup or list. Recently, the security team noticed that the network_summary index is missing data for certain sourcetypes, specifically those with hyphens in their names (e.g., `cisco-asa`, `juniper-srx`). For other sourcetypes, the summary is complete. The saved search runs without errors in Splunk's job inspector. Which course of action should the administrator take to resolve the issue?
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
✓
Modify the macro definition to enclose the `$sourcetype$` argument in quotation marks: `sourcetype="$sourcetype$"`
When a macro argument contains special characters like hyphens, Splunk may misinterpret them as operators (e.g., subtraction) or search syntax modifiers. Enclosing the `$sourcetype$` argument in quotation marks, i.e., `sourcetype="$sourcetype$"`, ensures the entire value is treated as a literal string, preventing parsing errors for sourcetypes with hyphens. Option A is incorrect because increasing the index range doesn't address the parsing issue. Option C is unrelated to the sourcetype name problem. Option D is irrelevant as acceleration does not fix data ingestion or search syntax issues.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Increase the summary index range to cover all sourcetypes in one pass rather than iterating.
Why it's wrong here
This does not address the parsing issue with hyphens.
- ✓
Modify the macro definition to enclose the `$sourcetype$` argument in quotation marks: `sourcetype="$sourcetype$"`
Why this is correct
Quoting prevents hyphens from being interpreted as search operators.
- ✗
Change the macro's time_range argument to use a static time range to avoid relative time issues.
Why it's wrong here
Time range is not the cause; the problem is specific to sourcetypes with hyphens.
- ✗
Enable acceleration on the network_summary index to improve data completeness.
Why it's wrong here
Acceleration does not affect the data insertion process.
Visual reference
Go deeper
Related to this question
About these practice questions
One of 475 original SPLK-1002 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-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.