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!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...