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!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...