Knowledge Management

macro with localop?

vbumgarner
Contributor

Is there any way to start a macro with a generator command? I get the error "The command must be the first command of a search."

Tags (1)
0 Karma
1 Solution

hazekamp
Builder

Vincent,

You can have macros that make use of generating commands, but the error is likely correct in that certain search commands (i.e. metadata) must be the first command of a search.

## macros.conf
[metadata]
definition = metadata type=hosts index=*
iseval = 0

## search
| `metadata`

View solution in original post

0 Karma

hazekamp
Builder

Vincent,

You can have macros that make use of generating commands, but the error is likely correct in that certain search commands (i.e. metadata) must be the first command of a search.

## macros.conf
[metadata]
definition = metadata type=hosts index=*
iseval = 0

## search
| `metadata`
0 Karma

gkanapathy
Splunk Employee
Splunk Employee

It is lame. Can you do it if you make it into an iseval=1 definition returning a string?

0 Karma

vbumgarner
Contributor

We figured that out, but it's kinda lame. It'd be nice to have the pipe in the definition.

0 Karma
Get Updates on the Splunk Community!

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 ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...