Security

What is regex for below?

karu0711
Communicator

FW: [ DOC 45 ] DTP: DEMO XXX CCC | 20147
I want to extract number after pie as field name "data".  what is the regex?

Labels (1)
Tags (1)
0 Karma

manjunathmeti
SplunkTrust
SplunkTrust

You can check this and get to know how the data is extracted.
https://regex101.com/r/dECVmS/1 

0 Karma

The_Data_Pirate
Splunk Employee
Splunk Employee

Hi Karu, this should work by taking the raw data and only selecting the digits after the pipe character. The space after the pipe is ignored before the digits are placed into a new field named data.

| rex field=_raw "\|\s(?<data>\d*)"

 

karu0711
Communicator

FW: [ DOC 45 ] DTP: DEMO XXX CCC | 20147

I also need to separate [ DOC 45] as category 
DTP as type 

demo xxx ccc as call

 

0 Karma

The_Data_Pirate
Splunk Employee
Splunk Employee

as long as the data structure doesn't change too much this should work.

 

| rex field=_raw ".*\[\s(?<category>.*)\s\]\s(?<type>\w*).*\|\s(?<data>\d*)"

somesoni2
SplunkTrust
SplunkTrust

Give this a try

\|(?<data>\d+)
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...