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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...