Splunk Cloud Platform

How to create Macros based on field list?

SplunkExplorer
Contributor

Hi Splunkers, I'm trying to send one Splunk Cloud instance alerts to a Cortex XSOAR one.
The guide I'm following is the following one: Splunk py for NON ES users. Due we have not Enterprise Security, I must follow steps described in section Splunk non-Enterprise Security Users. 

Following this guide, what makes me a bit confused is step 4; they states only to create a macro to capture fields saved on a local file, but no indication on how to achieve this. I mean: I know I can put in macro code I want to reuse in more alerts, for example reuse the same where conditions in multiple different rules, but how should be the syntax to achieve what the guide states?

For example, if following step 2 and 3 I got the following field list:

list(field)
Blade,
ReachedPorts,
count,
dst_ip,
earliest_timestamp,
latest_timestamp,
src_ip,
src_user,
total_dst_port,

what code should I put on macro to "capture" them? Should I simply put fields list in macro code?

 

Tags (2)
0 Karma

bowesmana
SplunkTrust
SplunkTrust

Those instructions are somewhat strange - the save to a local file seems a bit redundant and I'm not sure I understand the purpose of creating a macro with the table statement and the field list - unless you're going to re-use that macro in other places.

It seems like all they have done is Settings->Advanced Search->Macros and created a new macro with 

table list_of_field_names

so, it seems like all it is telling you is to make a table command with the wanted fields in the macro. 

Don't prefix it with the | symbol, so you can do

| `my_macro`

but I guess it's up to you if you feel you need a macro in the first place.

SplunkExplorer
Contributor

I share your own doubts.

Thanks for answer, I will try; may be I found an alternative way, so your help is enough for now.

0 Karma

SplunkExplorer
Contributor

Hi Slunkers, anyone able to help me on this issue?

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...