Splunk Search

regex help

surekhasplunk
Communicator

Hi,

My sample code looks like below :

Mon Mar  9 14:18:14 2020: Unknown trap (.1.1.1.1.1..1) received from hostname.abcd.com at: 
Value 0: hostname.abcd.com
Value 1: 1.2.3.4
Value 2: 11.22.33.44

Another sample value is 

Mon Mar  9 13:38:23 2020: Unknown trap (.1.2.3.4.5.6) received from 19.19.19.19 at: 
Value 0: 19.19.19.19
Value 1: 4.4.4.4.4
Value 2: 12.13.14.15

Value 0: give me either the IP or the hostname .
I need to extract field called machine_name with the value of Value 0:

Tags (2)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @surekhasplunk,
try this:

(?ms)Value\s+0:\s+(?<value0>[^ ]+)Value

that you can test at https://regex101.com/r/SlYtf3/1

Ciao.
Giuseppe

View solution in original post

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @surekhasplunk,
try this:

(?ms)Value\s+0:\s+(?<value0>[^ ]+)Value

that you can test at https://regex101.com/r/SlYtf3/1

Ciao.
Giuseppe

0 Karma

surekhasplunk
Communicator

Thanks @gcusello It worked 🙂

0 Karma

gcusello
SplunkTrust
SplunkTrust

You're welcome!
Ciao and next time.
Giuseppe

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...