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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...