Splunk Search

Unable to Extract Multiple values into a single feild ?

rakshithreddy
Explorer

Hi Everyone,

I was unable to extract multiple Values into one feild from the the below Event data,
Was trying to extract all data between xyz - /xyz into one single feild,
Its working with including |rex max_match=100 - in the search query as ( search |rex max_match=100 "xyz(?P.*?)\/xyz>" )
But looking for an alternative which extracts multiple values into one single feild at writing regular expression level.

ams
xyzStats.QuarterHour.CRCErrors/xyz>\x1B

xyzQuarterHourStart/xyz>\x1B

xyzDownstreamNoiseMargin/xyz>\x1B

xyzUpstreamCurrRate/xyz>\x1B

xyz.WANDSLInterfaceConfig.Status/xyz>\x1B
/ams>\x1B

Thank you.

Tags (1)
0 Karma

DalJeanis
Legend

Be sure to mark your code as code so the interface doesn't act on what it thinks are html tags or formatting commands.

It sounds like you are looking for the nomv command, which turns a multivalue field into a regular field separated by (usually) spaces ...

your search
| rex max_match=0 "xyz(?<myXyz>[^\/]*)\/xyz>"
| nomv myXyz

By the way, when you know that a field will never include a particular character and will always end on that character, you can use that single character as a negative character class, which makes the rex slightly more efficient in the case of a near-but-nonmatch.

0 Karma

rakshithreddy
Explorer

Thanks for the revert. I understand that max_match=0 will give me the desired result. But in all the search queries wherever i need to extract that respective filed i have to write the rex.

is there a way that whenever i am having max_match i can configure it in Splunk and automatic fields get extracted. I tried but automatic filed extractor doesn't accept max_match parameter.

0 Karma

niketn
Legend

You might have to put code sections of your question using code button (101010) to avoid escaping.

Rex will generate field with multiple values is you have enables max_match=100. You can set the same to zero if you want to find all matches i.e. max_match=0.

So, you might have to also explain what is it that you intend to do with your data and also with is the current issue with rex using max_match?

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

cmerriman
Super Champion

you're looking for another way besides using max_match? or you want another regex statement? I'm not sure you can extract an MV field without the max_match, but i could be wrong.

0 Karma

rakshithreddy
Explorer

Thank you,
Cant find how to Extract MVfield without max_match.

0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...