Splunk Search

Macro and Comment Fields


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


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
.conf21 Now Fully Virtual!
Register for FREE Today!

We've made .conf21 totally virtual and totally FREE! Our completely online experience will run from 10/19 through 10/20 with some additional events, too!