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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

Splunk is officially part of Cisco

Revolutionizing how our customers build resilience across their entire digital footprint.   Splunk ...

Splunk APM & RUM | Planned Maintenance March 26 - March 28, 2024

There will be planned maintenance for Splunk APM and RUM between March 26, 2024 and March 28, 2024 as ...