Splunk Search

I have a problem in creating regex for below expression?

pal_sumit1
Path Finder

expression:
2018-02-2008:13:44|ABC1034|Sumit Martin|0|147707|Amit|SURESH||19490616|M|2030 SQ 16 PERRA|ABC E-212|INDIA|FL|33125|7863174200|Tiger|Transportation|Created|

I have created regex for extracting threefields but not able figure out how to write for other fields.You can assign any name for fields.
Below is my regex:
(?timestamp(\d{4})-(\d{2})-(\d{4}):(\d{2}):(\d{2}))|(?id([A-Z]{3}\d{4}))|(?contact(\d{10}))

After the ? ,there is < timestamp and after field name >. Splunk editor is not allowing me to add that .eg:- < timestamp ">"
Don't keep double quotes.

Thanks.

0 Karma

jodyfsu
Path Finder

Hello, could you provide a sample event?

0 Karma

somesoni2
Revered Legend

Try this (they pipe separated values so regex doing the same, dummy field names are used here, update per your data and it's sequencing in the data)

###props.conf on Search Head
[yourSourceType]
EXTRACT-fields = ^(?<Timestamp>[^\|]+)\|(?<field1>[^\|]+)\|(?<field2>[^\|]+)\|(?<field3>[^\|]+)\|(?<field4>[^\|]+)\|(?<field5>[^\|]+)\|(?<field5>[^\|]+)\|(?<field1>[^\|]+)\|(?<field1>[^\|]+)\|(?<Timestamp>[^\|]+)\|(?<field1>[^\|]+)\|(?<field1>[^\|]+)\|(?<field1>[^\|]+)\|(?<field1>[^\|]+)\|(?<field1>[^\|]+)\|(?<field1>[^\|]+)\|(?<field1>[^\|]+)\|(?<field1>[^\|]+)\|

OR (props.conf and transforms.conf on Search Head)

###props.conf on Search Head
[yourSourceType]
REPORT-fields = psv_fields_for_yourSourceType

###transforms.conf on Search head
[psv_fields_for_yourSourceType]
DELIMS = "|"
FIELDS = "timestamp", "field1", "field2",...comma separated list of all fields..
0 Karma

somesoni2
Revered Legend

If you want to extract the field inline in the search, the regular expression from first option (EXTRACT-fields) in your rex command.

0 Karma
Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...