Courseiva
Macros, Saved Searches and CIMmediumMultiple SelectObjective-mapped

Creating Macros in Splunk: Methods and Configuration

Which TWO of the following are valid ways to create a macro in Splunk? (choose two)

Quick Answer

Macros in Splunk can be created through two equally valid mechanisms that ultimately produce the same result: a configuration entry Splunk reads at startup. The GUI path, Settings > Advanced search > Search macros, is the standard, supported way most users create macros, and it works by writing that same configuration behind the scenes. The file-based path accomplishes the identical outcome directly, by manually creating or editing a macros.conf file in $SPLUNK_HOME/etc/system/local/ and adding the macro's stanza and definition there, which Splunk picks up the same way it does GUI-created macros. Both routes end up as macro definitions in macros.conf; the GUI is just a friendlier interface for editing that same underlying configuration file rather than a fundamentally different mechanism. This dual nature, a GUI method backed by a corresponding .conf file that can also be edited directly, is common across many Splunk knowledge objects like macros, lookups, and saved searches, and exam questions often test whether you know that the file-based route is just as legitimate as the interface-based one, not some kind of workaround. When you see a question asking for valid ways to create or configure a Splunk object, expect the GUI method and its equivalent direct .conf file edit to both be correct answers rather than only one of them.

⚠ Common exam trap

Watch out — candidates often confuse the valid configuration file location (local directory) with the default directory, or mistakenly think a CLI command exists for macro creation, when Splunk only supports GUI or manual file-based methods.

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

Navigate to Settings > Advanced search > Search macros and click 'New'.

Splunk provides a GUI-based method to create macros via Settings > Advanced search > Search macros, which is a standard and supported approach. Option D is correct because manually creating a macros.conf file in $SPLUNK_HOME/etc/system/local/ is a valid configuration method that Splunk reads at startup to define macros.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Add a macro definition to props.conf under a [source] stanza.

    Why it's wrong here

    Macros are not defined in props.conf.

  • Use the CLI command `splunk add macro` with the macro definition.

    Why it's wrong here

    There is no CLI command to add macros.

  • Navigate to Settings > Advanced search > Search macros and click 'New'.

    Why this is correct

    This is the UI method.

  • Create a macros.conf file in $SPLUNK_HOME/etc/system/local/ and add the macro definition.

    Why this is correct

    This is the file-based method.

  • Edit the macros.conf file in the app's default directory.

    Why it's wrong here

    The default directory is not for local configurations; local directory is used.

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 →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

1 more way this is tested on SPLK-1002

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. Which of the following are valid ways to define a macro in Splunk? (Choose two.)

easy
  • A.Using the `macro` command in a saved search
  • B.Using the `| macro` command in a search
  • C.Using named arguments like $field$ in the definition, with the argument names defined in the macro properties
  • D.Using the `define` command in the search bar
  • E.Using positional arguments like $1$ in the definition

Why C: Options C and E are correct ways to define a macro in Splunk. Macros can use named arguments (e.g., $field$) with argument names defined in the macro properties, or positional arguments (e.g., $1$, $2$) that are referenced by position. Option A is incorrect because the `macro` command does not exist; macros are defined in Settings > Advanced Search > Search Macros. Option B is incorrect because there is no `| macro` search command. Option D is incorrect because there is no `define` command for macros; macros are defined in the knowledge object settings.

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.