Splunk Search

How to highlight only specific term?

melonman
Motivator

Hi,

I am trying to highlight only a specific term specified by highlight command like this:

index=* man | highlight from

However, with the search above, "man" and "from" are highlighted.
Is there any way to highlight only "from"?
(I don't want to highlight "man", which is search result from a search before pipe.)

Thank you!

Tags (3)
1 Solution

MHibbin
Influencer

Not really an answer, but I don't think this is easily possible... there is an old question relating to this here (it mentions the CSS method which I don't think is worth it as you will still want to highlight terms).

So I think the answer to your question is "no", unless the "man" term is something that can be extracted as a field (or part of a field) in which case you could modify your search to something like..

index=* yourField=man | highlight from

This would stop the highlighting, as it will be filtering on the fields.

Regards,

MHibbin

View solution in original post

0 Karma

Drainy
Champion

Sure, but its not particularly pretty. Splunk won't highlight any field matches in your search terms, so blah=man will not be highlighted.

A quick and dirty way to do this (I would be more specific on the rex 😉 ) is;

* something=morespecific source=blah | rex "(?<my_field>man)" | search my_field=man| highlight from

melonman
Motivator

Thank you for your post.
* I accepted the first one

0 Karma

MHibbin
Influencer

Not really an answer, but I don't think this is easily possible... there is an old question relating to this here (it mentions the CSS method which I don't think is worth it as you will still want to highlight terms).

So I think the answer to your question is "no", unless the "man" term is something that can be extracted as a field (or part of a field) in which case you could modify your search to something like..

index=* yourField=man | highlight from

This would stop the highlighting, as it will be filtering on the fields.

Regards,

MHibbin

0 Karma

melonman
Motivator

Thank you!
This is something I need to do, I understood.

0 Karma
Get Updates on the Splunk Community!

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...