Splunk Search

Regex in splunk

thambisetty
SplunkTrust
SplunkTrust

Hi,
I have data like below,

Contact_Number---------------Name

land="1234" Phone="324"------Kumar
land="3254" phone="458"------Ramu

Now what i want is Phone number of each and every person like below,

Contact_Number---------------Name

Phone="324"----------------Kumar
phone="458"-----------------Ramu

please help me.
Note:In the data there are only two fields one is "contact number" and another one is "Name",
In the Contact Number there are two fields now i want to extract one field for one Name.

————————————
If this helps, give a like below.
Tags (1)
0 Karma

sanju1323
Engager

Hi,
I also have same doubt..
Thanks man, it worked for me. But, I need only physical as a field. Is it possible through REX. And please suggest me some good website or something to learn entirely about rex command.
Thank you.

0 Karma

dmaislin_splunk
Splunk Employee
Splunk Employee
* | rex field=_raw "\stype=\"\"(?<type>.+?)\"\""

dmaislin_splunk
Splunk Employee
Splunk Employee
 * | rex field=_raw "[Pp]hone="(?<Contact_Number>.+?)"-+(?<Name>.+)"

Where your regex is:

[Pp]hone="(?<Contact_Number>.+?)"-+(?<Name>.+)
0 Karma

dmaislin_splunk
Splunk Employee
Splunk Employee

Just confirming that: type=""physical"" has two double quotes surrounding it? Is this a copied event from Splunk or is it something you manually typed into this answers? The quotes don't make sense since there is a " before date like "date but no end quote.

0 Karma

thambisetty
SplunkTrust
SplunkTrust

firewall,"date=10-20-2000 time=01:29:22 name=Donated device_id=123456 log_id=654321 type=""phisical"" subtype=block pri=notice
This is one field in my logs. I need to extract type=""phisical"" as a field. pls help using REX

————————————
If this helps, give a like below.
0 Karma

dmaislin_splunk
Splunk Employee
Splunk Employee

The regex is valid, check it out here: http://regex101.com/r/lY6pS8

Is this data already indexed in Splunk? If so, what is the sourcetype, can you also display the props.conf or transforms.conf for this data?

It this data coming in as a single Splunk event?

0 Karma

thambisetty
SplunkTrust
SplunkTrust

Thanks for your quick response but its not working..
please do help..

————————————
If this helps, give a like below.
0 Karma
Get Updates on the Splunk Community!

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 ...

Accelerating Observability as Code with the Splunk AI Assistant

We’ve seen in previous posts what Observability as Code (OaC) is and how it’s now essential for managing ...