Splunk Search

Macro and Comment Fields

albyva
Communicator

Is it possible to add a comment field in a Macro so that it is displayed in a search?
For example, if a macro contains ((host="router1" AND (interface="ethernet0"))
and I want to label that macro line as being SanFranciscoRouter so that in a search that looks like (index=main splunkmacro | table host interface ) I can get an output that displays the router/interface/description?

My PhoDream: ((description=SanFranRouter host="router1" AND (interface="ethernet0"))
Pho Output: SanFranRouter router1 ethernet0

Let me know if my question isn't clear, but overall I just want to label each of my macro entries so the data and label from a macro are displayed from a search. Thanks,

Tags (2)
0 Karma

Ayn
Legend

You could do this if you used eventtypes instead of (or in addition to) macros. You would set up an eventtype with this search you provided, and then use the eventtype name as your descriptor. eventtype will be included as a field so you can just include that in your table and get what you're after.

0 Karma
Get Updates on the Splunk Community!

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

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...