Splunk Search

Is it possible to highlight a specific term from an inputlookup?

TheJagoff
Communicator

All;
I am running Splunk 6.3.5 and need to see what term "hits" in the resulting event. The search is:

index=proxysg sourcetype=proxysg_base [|inputlookup aterms.csv | return 10000 $aterms]

I attempted to use index=proxysg sourcetype=proxysg_base [|inputlookup aterms.csv | return 10000 $aterms] |highlight $aterms
with no luck.

Is this possible? I have seen this done automatically in 6.5. without the |highlight

Many thanks.

1 Solution

somesoni2
SplunkTrust
SplunkTrust

The highlight accepts the string that you want to highlight. You're passing string to your base search to filter records, pass same strings to highlight commands using subsearch like this:

 index=proxysg sourcetype=proxysg_base [|inputlookup aterms.csv | return 10000 $aterms] | highlight  [|inputlookup aterms.csv | return 10000 $aterms]

View solution in original post

somesoni2
SplunkTrust
SplunkTrust

The highlight accepts the string that you want to highlight. You're passing string to your base search to filter records, pass same strings to highlight commands using subsearch like this:

 index=proxysg sourcetype=proxysg_base [|inputlookup aterms.csv | return 10000 $aterms] | highlight  [|inputlookup aterms.csv | return 10000 $aterms]

TheJagoff
Communicator

Hi, yes that works and many thanks! It also highlights the word "or" in the events log so I'm assuming that this is occurring because of the implied "expression1" or "expression2" or "expresion3" or ... that is happening due to the inputlookup? I'm guessing that this will just have to be because of the nature of the command. Many thanks again.

0 Karma

somesoni2
SplunkTrust
SplunkTrust

You're right about 'OR' being highlighted due to the subsearch returning a giant OR expression. You can avoid this by changing the subsearch of highlight command as below.

index=proxysg sourcetype=proxysg_base [|inputlookup aterms.csv | return 10000 $aterms] | highlight  [|inputlookup aterms.csv | table aterms | rename aterms as search | format "" "" "" "" "" ""]

cmerriman
Super Champion
0 Karma
Get Updates on the Splunk Community!

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...