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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...