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!

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...

What’s New in Splunk Observability – September 2025

What's NewWe are excited to announce the latest enhancements to Splunk Observability, designed to help ITOps ...

Fun with Regular Expression - multiples of nine

Fun with Regular Expression - multiples of nineThis challenge was first posted on Slack #regex channel ...