I am trying to populate an input field using the following lines in XML dashboard source
<populatingSearch fieldForValue="host" fieldForLabel="host">
<![CDATA[|metadata type=hosts index=os host="ABC*"]]>
</populatingSearch>
I am adding host="ABC*" for it to display only host names having ABC, but it is still displaying all the host names. How do I make it display just ABC host names?
Keep it simple and just filter the output of the metadata command with a search command.
<populatingSearch fieldForValue="host" fieldForLabel="host">
<![CDATA[|metadata type=hosts index=os | search host="ABC*"]]>
</populatingSearch>
Keep it simple and just filter the output of the metadata command with a search command.
<populatingSearch fieldForValue="host" fieldForLabel="host">
<![CDATA[|metadata type=hosts index=os | search host="ABC*"]]>
</populatingSearch>
@sideview
Works !! Thanks...
I would like to know if my new proposed answers do not work? thanks
hi sushmitha_mj,
try this
<populatingSearch fieldForValue="host" fieldForLabel="host">
<![CDATA[|metadata type=hosts index=os host=* |stats count (host) | where like(host,"ABC%")]]>
</populatingSearch>
If this does not work, try to use stats count
by host as this:
<populatingSearch fieldForValue="host" fieldForLabel="host">
<![CDATA[|metadata type=hosts index=os host=* |stats count by host | where like(host,"ABC%")]]>
</populatingSearch>
@gyslainlatsa
Does not work. It does not list the hosts at all. It just lists "all" and when I select that,
all hosts are displayed.
remove values() and put count() as specified above
@gyslainlatsa
Your second solution also worked!! Thanks...