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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...