Splunk Search

How do I highlight just a line from the event?

abhinandan_rang
New Member

I have a event as below, and I want to highlight the entire line "Message: Processing - UnAuthenticated User". Message is not a field, its just a string.

Date: 21-02-2018 04:29:15.930
Activity ID: b10d94dc-85fa-4ec2-aca9-7fadbf0479
Message: Processing - UnAuthenticated User

Tags (1)
0 Karma

FrankVl
Ultra Champion

I would say: look a the highlight command for that, but when testing that on my local instance that doesn't seem to work for phrases that contain characters like : (even though highlighting just a single ":" works perfectly fine)...

You should be able to use it to highlight the "UnAuthenticated User" phrase though, would that suffice?

0 Karma

abhinandan_rang
New Member

Hi Frank,
Here in my example, that is a single event. There are multiple events. Every event will have a different Message text. And my requirement is to highlight Message: XXXXXX XXXXX XXXXX of every event. The entire line. And in every event its a different message text.
Regards,
Abhi

0 Karma

FrankVl
Ultra Champion

Well, the highlight command doesn't support regular expressions or wildcards or anything, so that will be difficult. If the number of possible message texts is limited, you could create a macro that contains a highlight command with all possible message strings behind it.

0 Karma

elliotproebstel
Champion

In my local testing, highlight works fine on a string containing a colon. I think your suggestion will work fine, as long as the @abhinandan_rangasham is looking to highlight within raw events and not anything that's doing stats or other transforming commands.

0 Karma

FrankVl
Ultra Champion
0 Karma

elliotproebstel
Champion

Interesting. I tried the exact same thing on my box and see what you see. However, it works if I change it to

| highlight "op=PAM:session_close"

So I think it has more to do with Splunk looking for breakers than specifically to do with colons. But either way, you are totally right that the command seems fussy and should be handled with care. 🙂

0 Karma

FrankVl
Ultra Champion

Good catch, you can also see that behavior a bit when hovering over the raw event with your mouse. When you start hovering from op= it will highligh "op", when you move to the right a bit, it highlights op=PAM, moving further, it highlights op=PAM:session, and eventually op=PAM:session_close.

So the highlighting indeed seems to somehow have something to do with how Splunk internally breaks up the raw event into substrings for searching etc.

So yeah, @abhinandan_rangasham, give it a try, probably for highlighting that entire line, it will work just fine 🙂

0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...