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!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...