SPLK-1002 · Question #170
A macro has another macro nested within it, and this inner macro requires an argument. How can the user pass this argument into the SPL?
The correct answer is D. An argument can be passed to the inner macro by nesting parentheses. In Splunk, macros support nesting - one macro's definition can call another macro. When the inner macro requires an argument, you pass that argument by nesting the argument inside parentheses within the macro call syntax. For example, calling `…
Question
A macro has another macro nested within it, and this inner macro requires an argument. How can the user pass this argument into the SPL?
Options
- AAn argument can be passed through the outer macro.
- BAn argument can be passed to the outer macro by nesting parentheses.
- CThere is no way to pass an argument to the inner macro.
- DAn argument can be passed to the inner macro by nesting parentheses.
How the community answered
(17 responses)- B6% (1)
- D94% (16)
Explanation
In Splunk, macros support nesting - one macro's definition can call another macro. When the inner macro requires an argument, you pass that argument by nesting the argument inside parentheses within the macro call syntax. For example, calling `outer_macro(`inner_macro(arg_value)`)` uses nested parentheses to supply the argument directly to the inner macro. The outer macro does not automatically relay arguments to its nested macros (ruling out A and B). Option C is incorrect - Splunk does support argument passing to nested macros via this parentheses-nesting approach.
Topics
Community Discussion
No community discussion yet for this question.