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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...