Splunk Search

Need help with field-extractions on these events

gabrieldiasrosa
New Member

I have the following value:

Events
X|0001|NAME|PHONE
X|0002|NAME|ADDRESS|INFO1|INFO2

Based on the type (0001 or 0002) I want to extract different fields, is it possible ?

Can I split the event value based on a common separator (pipe) ?

0 Karma

cpetterborg
SplunkTrust
SplunkTrust

You can extract all the fields with this regex:

^(?P<f1>[^|]*)\|(?P<f2>[^|]*)\|(?P<name>[^|]*)\|((?P<phone>[^|]*)|((?P<address>[^|]*)\|(?P<info1>[^|]*)\|(?P<info2>[^|]*)))$

You will have to change the field names as you wish them to be, but it will extract the fields from either the first or second example lines. It's also fairly efficient.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Reprocessing XML into Fixed-Length Events

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

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...