Splunk Search

how to call a macro from the CLI

mataharry
Communicator

how to call a macro from the CLI ? I tried splunk search " * | mymacro | table *" and got Error in 'SearchParser': Missing a search command before '|'.

Tags (3)
1 Solution

yannK
Splunk Employee
Splunk Employee

To call a macro from the cli, please use the escaped ` characters. (not ' not ") example to call the macro testmacro

in the GUI:   index=_internal | `testmacro` | table itime

in the CLI:    splunk search " index=_internal | \`testmacro\` | table itime "

View solution in original post

yannK
Splunk Employee
Splunk Employee

To call a macro from the cli, please use the escaped ` characters. (not ' not ") example to call the macro testmacro

in the GUI:   index=_internal | `testmacro` | table itime

in the CLI:    splunk search " index=_internal | \`testmacro\` | table itime "
Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk, and empower your SOC to reach new heights! Duration: 1 hour  Prepare to ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...