Splunk Search

How to create rex to extract field?

Harish2
Path Finder

From here i need to extarct the identification=MLAS, MLA, LAS and VAM
My sample logs:
[12/12/21] 12:10:112 GMT] I6789HIOO applicattion authenticationid=100| |35467577889999| |67775-ghhgfrt-6788h-7667788; clientid="7689-jhgg-8765r-kkjggt"; app=" "; QueryLetter="yard=MS&identification=MLAS&timeRange=EVERYDAY&timePeriod=MINUTES

[12/12/21] 12:10:112 GMT] I6789HIOO applicattion authenticationid=100| |35467577889999| |67775-ghhgfrt-6788h-7667788; clientid="7689-jhgg-8765r-kkjggt"; app=" "; QueryLetter="yard=MS&identification=MLA&timeRange=EVERYDAY&timePeriod=MINUTES

[12/12/21] 12:10:112 GMT] I6789HIOO applicattion authenticationid=100| |35467577889999| |67775-ghhgfrt-6788h-7667788; clientid="7689-jhgg-8765r-kkjggt"; app=" "; QueryLetter="yard=MS&identification=LAS&timeRange=EVERYDAY&timePeriod=MINUTES

[12/12/21] 12:10:112 GMT] I6789HIOO applicattion authenticationid=100| |35467577889999| |67775-ghhgfrt-6788h-7667788; clientid="7689-jhgg-8765r-kkjggt"; app=" "; QueryLetter="yard=MS&identification=VAM&timeRange=EVERYDAY&timePeriod=MINUTES

in my selected fileds or intresting fileds  indeentification fileds  should appear has below:
MLAS
MLA
LAS 
VAM

Labels (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

The rex command works for me.

| rex "identification=(?<identification>\w+)"
---
If this reply helps you, Karma would be appreciated.

View solution in original post

yuanliu
SplunkTrust
SplunkTrust

Are posted logs raw events?  Is there some settings in your sourcetype (props.conf) that prevents automatic extraction of the fields you wanted?  Because the field names and values are connected by equal sign, Splunk should have already extracted them.

Here is an emulation of your samples:

 

| makeresults
| fields - _time
| eval data = split("[12/12/21] 12:10:112 GMT] I6789HIOO applicattion authenticationid=100| |35467577889999| |67775-ghhgfrt-6788h-7667788; clientid=\"7689-jhgg-8765r-kkjggt\"; app=\" \"; QueryLetter=\"yard=MS&identification=MLAS&timeRange=EVERYDAY&timePeriod=MINUTES
[12/12/21] 12:10:112 GMT] I6789HIOO applicattion authenticationid=100| |35467577889999| |67775-ghhgfrt-6788h-7667788; clientid=\"7689-jhgg-8765r-kkjggt\"; app=\" \"; QueryLetter=\"yard=MS&identification=MLA&timeRange=EVERYDAY&timePeriod=MINUTES
[12/12/21] 12:10:112 GMT] I6789HIOO applicattion authenticationid=100| |35467577889999| |67775-ghhgfrt-6788h-7667788; clientid=\"7689-jhgg-8765r-kkjggt\"; app=\" \"; QueryLetter=\"yard=MS&identification=LAS&timeRange=EVERYDAY&timePeriod=MINUTES
[12/12/21] 12:10:112 GMT] I6789HIOO applicattion authenticationid=100| |35467577889999| |67775-ghhgfrt-6788h-7667788; clientid=\"7689-jhgg-8765r-kkjggt\"; app=\" \"; QueryLetter=\"yard=MS&identification=VAM&timeRange=EVERYDAY&timePeriod=MINUTES", "
")
| mvexpand data
| rename data AS _raw
| extract

 

 These are the fields extracted:

QueryLetterappauthenticationidclientididentificationtimePeriodtimeRange
"yard=MS 100| |35467577889999| |67775-ghhgfrt-6788h-76677887689-jhgg-8765r-kkjggtMLASMINUTESEVERYDAY
"yard=MS 100| |35467577889999| |67775-ghhgfrt-6788h-76677887689-jhgg-8765r-kkjggtMLAMINUTESEVERYDAY
"yard=MS 100| |35467577889999| |67775-ghhgfrt-6788h-76677887689-jhgg-8765r-kkjggtLASMINUTESEVERYDAY
"yard=MS 100| |35467577889999| |67775-ghhgfrt-6788h-76677887689-jhgg-8765r-kkjggtVAMMINUTESEVERYDAY
0 Karma

richgalloway
SplunkTrust
SplunkTrust

The rex command works for me.

| rex "identification=(?<identification>\w+)"
---
If this reply helps you, Karma would be appreciated.

Harish2
Path Finder

Hi @richgalloway 
it worked, thank you

Get Updates on the Splunk Community!

New in Observability - Improvements to Custom Metrics SLOs, Log Observer Connect & ...

The latest enhancements to the Splunk observability portfolio deliver improved SLO management accuracy, better ...

Improve Data Pipelines Using Splunk Data Management

  Register Now   This Tech Talk will explore the pipeline management offerings Edge Processor and Ingest ...

3-2-1 Go! How Fast Can You Debug Microservices with Observability Cloud?

Register Join this Tech Talk to learn how unique features like Service Centric Views, Tag Spotlight, and ...