Splunk Search

How to execute macro search with REST API

pravinvram
Engager

How do i execute macros in rest API , example :

curl -ku user:pass https://<url> -d search="`macro name` | table data1 data2"

Labels (1)
Tags (2)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Escape the backticks.

curl -ku user:pass https://<url> -d search="\`macro name\` | table data1 data2"
---
If this reply helps you, Karma would be appreciated.
0 Karma

pravinvram
Engager

@richgalloway  - thanks for the details , tired that as well however receiving below error.

I own the macro and there is full permission read , still getting this error

<?xml version="1.0" encoding="UTF-8"?>
<response>
<messages>
<msg type="FATAL">User  could not act as: admin</msg>
</messages>
</response>

0 Karma

richgalloway
SplunkTrust
SplunkTrust

It looks like the macro is trying to execute, but the content requires permissions you don't have.  What are the search and macro trying to do?

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

(view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...

Adoption of Infrastructure Monitoring at Splunk

  Splunk's Growth Engineering team showcases one of their first Splunk product adoption-Splunk Infrastructure ...