Splunk Search

How to highlight values from the iplocation command?

jon_d_irish_ctr
Path Finder

I want to setup a search that determines which countries have connected to my network over the past "x" hours, and then I want to highlight the table line if a specified country shows up. Here is the search I have so far:

sourcetype=cisco:asa dest_ip="X.X.0.0/16" NOT "Failover primary closed" | iplocation src_ip | stats count by Country | sort - count | dedup Country | highlight "CountryName"

I get the table, but the highlighting never happens even if I pick a country that shows up in the table. Last, I would like for this search to trigger an alert and email the alert if the specified country is in the table.

Thanks!
Jon

0 Karma
1 Solution

niketn
Legend

@jon.d.irish.ctr, highlight would work only with Raw Events List not with transforming commands. You probably need a JavaScript Extension based solution to highlight specific text in your Table. Refer to one of following answers where TextBox filter is applied and highlighted.

https://answers.splunk.com/answers/636948/how-to-add-css-class-to-table-field-by-input-in-sp.html

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

View solution in original post

0 Karma

xpac
SplunkTrust
SplunkTrust

Just to mention it, there's no need to | dedup Country, cause after a stats by Country there won't be any duplicates for that field ever. To setup an alert, add a filter for your relevant countries (like | where Country="yourcountry"), and then just have the alert fire when there is more than 0 results. 🙂

0 Karma

wrangler2x
Motivator

Despite being in the documentation (which I've never noticed before) it does not appear to work at all. I just tried a very simple case that matches the sample search and... nothing. Sounds like you should report this as a bug.

http://docs.splunk.com/Documentation/Splunk/7.0.2/SearchReference/Highlight[link text]1

0 Karma

niketn
Legend

@wrangler2x highlight works with Raw Events when you display the same as list. It will not work with Transforming command like stats, table etc.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

wrangler2x
Motivator

Oh, I see. Yes, when I click the Events tab I do see the highlighting.

0 Karma

niketn
Legend

@jon.d.irish.ctr, highlight would work only with Raw Events List not with transforming commands. You probably need a JavaScript Extension based solution to highlight specific text in your Table. Refer to one of following answers where TextBox filter is applied and highlighted.

https://answers.splunk.com/answers/636948/how-to-add-css-class-to-table-field-by-input-in-sp.html

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

jon_d_irish_ctr
Path Finder

Thanks for the suggestion, I will give this a shot.

0 Karma

jon_d_irish_ctr
Path Finder

Here is another thought. What is I wrote out the results of the iplookup command to a lookup file via the outputlookup command. Next, if I do a search against that lookup file with the lookup command, would I then be able to use the highlight command?

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...