Reporting

Extracting multiple values from Rex

nirmeshsolanki
Explorer

Hello,

Looking for some assistance with the existing query
rex max_match=0 field=_raw "IP BLOCK TYPE\",value=\"(?<IP_Block_Type>.*?)\s*(\w*+)\]"|
eval IP_Block_Type= substr(IP_Block_Type, 1, len(IP_Block_Type)-1)

 

This query gives us a column with outputs

 

ovverride.png

Need assistance with pulling exact details in the column which will only have "OVERRIDE". 

Thanks

1 Solution

Nisha18789
Builder

Hi @nirmeshsolanki , can you try this and let me know if it works

|rex field=_raw "operation=\"(?<IP_Block_Type>.\w+)\""
|where isnotnull(IP_Block_Type)

View solution in original post

to4kawa
Ultra Champion

| rex "(?<your_want>\bOVERRIDE\b)"
| where isnotnull(your_want)
how about this?

Nisha18789
Builder

Hi @nirmeshsolanki , my bad but I am not sure what result you are expecting in field IP_Block_Type in final output, can you share the expected output you are looking for.

 

 

0 Karma

nirmeshsolanki
Explorer

Hi @Nisha18789 , I am looking for an output "OVERRIDE" in the column IP_BLOCK_TYPE.

so we have the below outputs in the column: 

Public
Private",descendants_action={option_with_ea:"INHERIT",option_without_ea:"NOT_INHERIT"},operation="OVERRIDE
 
Public",operation="OVERRIDE

But I am just looking for values containing OVERRIDE.

Thanks 

Nisha18789
Builder

Hi @nirmeshsolanki , can you try this and let me know if it works

|rex field=_raw "operation=\"(?<IP_Block_Type>.\w+)\""
|where isnotnull(IP_Block_Type)

nirmeshsolanki
Explorer

Hi @Nisha18789 

 

Thanks a lot for the help in the previous query, I missed adding one more detail on the previous post which is :

Messages which I see in my column:

1.[name="IP BLOCK TYPE",value="Private",operation="OVERRIDE"]

2.[name="IPBLOCKTYPE",value="Public",descendants_action={​​​​​​​​option_with_ea:"INHERIT",option_without_ea:"NOT_INHERIT"}​​​​​​​​,operation="OVERRIDE"]

Your solution works perfectly for 1st logic, need to add some query to the second option which would block descendants_action in the query which you provided earlier.

Thanks a lot again.

0 Karma

nirmeshsolanki
Explorer

Worked perfectly.

 

Thanks a lot.

0 Karma

somesoni2
Revered Legend

What's the raw data for which your regex currently extract those field values?

 

Give this a try as well.

rex max_match=0 field=_raw "IP BLOCK TYPE\",value=\"(?<IP_Block_Type>[^\"]+)"

nirmeshsolanki
Explorer

@somisoni2 the query you provided gives me "Publi" and "Privat" outputs in the table.

0 Karma

nirmeshsolanki
Explorer

@somesoni2 The query you provided, gives me all the possible results which come under IP_BLOCK_TYPE

override_max.png

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!

Laser Bananas and Edge Hubs: Exploring Operational Technology (OT) Data Through a ...

  OT is a different environment to traditional IT and can have interesting challenges when interfacing the ...

Event Series: Mastering AI Tokenomics and Splunk Agent Observability

Beyond the Black Box: Correlating AI Performance and Tokenomics with Splunk Agent Observability   As ...

span_metrics: The OpenTelemetry-Idiomatic Way to See Inside Your Services

You open a trace in Splunk Observability Cloud and everything looks fine. One root span, order-pipeline, with ...