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!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...