Back to Floor
The Spell Book • Room 1

Parameterized Macros

A macro with arguments is defined with its argument count in the name: `my_macro(2)`. The arguments are referenced inside the macro definition using `$arg1$` and `$arg2$`.

This allows you to create reusable SPL templates that accept dynamic values at runtime.

Defining a Macro (Settings)
Name: get_errors(1)
Definition: index=$index_name$ level=ERROR | stats count by source
Calling the Macro
`get_errors("web_logs")`

Knowledge Check

Prove your understanding to clear the room (Rewards XP)
Fill in the macro calling syntax.
To call a macro named errors_by_host with 1 argument, you write ______ and reference the argument inside the definition with ______.