Splunk Search

Extract certain keyword from column

timyong80
Explorer
  1. There are two lines of info in a column but it appears that there's no whitespace or whatsoever in between those lines. I would only want to extract the bottom line and output the result into a new column called 'Target' but the rex command that I have just refused to pull that info on the second line. I have tested the command in the Regex online simulator and it works but in the real Splunk environment, it doesn't seem to be able to extract it.

| rex field=Account_Name "\n.+(?)$"

alt text

  1. I would like to extract the server name (HOEFCE30A) from the _raw column but if I use rex, there's no unique value to identify where Splunk should start to pull that info since the beginning part of the column is date and time which changes every time.

| rex "xxx=(?<"Server">.+) CEF"

alt text

Any help would be greatly appreciated. Thank you very much! 🙂

0 Karma

sundareshr
Legend

Try this for the Account_Name

rex field=Account_Name "[\t\n\s](\w+)"

AND, this for Server

rex field=_raw "\d\d:\d\d:\d\d\s(?<server>\w+)"
0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...