Splunk Search

How to get a field extraction of a field extraction within one regex?

Marco204
Explorer

Hi there,

so I have a line of log like this:

http://some.url/path/?param=x,y,z 

So I want to extract a field "extractedParam" with the value "x,y,z".

Then I want to extract the three values into a multivalue field "mvExtractedParam".

Within Splunk Cloud I will use a field extraction with the following regex which is wrapped up by a field transformation (here I can check "Create multivalued fields").

So I try to do everything within one regex, but here I am struggling.

\?param=(?<extractedParam>.*)

This extracts "x,y,z".

Right now I dont know how to chain the next step...

 

All the best,
Marco

Labels (2)
0 Karma
1 Solution

Marco204
Explorer

Well, that was pretty straight forward @PickleRick 🙂

So I was able to do it within the SPL:

mainsearch | eval mvExtractedParam=split(extractedParam, ",")

And I was able to create a field transformation using "extractedParam" as the value for Source Key and the easy Regular expression:

(?<mvExtractedParam>\w+)

Thanks a lot,
Marco

PS: never forget to create a field extraction that uses the field transformation, just for the purpose of enabling it...

View solution in original post

0 Karma

PickleRick
SplunkTrust
SplunkTrust

I suppose you could try to extract values from that field you've just extracted but it would need creating transform manually with source key specified as your newly extracted key. I'm not sure however how you go with webui about reordering transforms.

So you can as well just add a calculated field that splits your extractedParam into a multivalued field. I think that's more straightforward.

0 Karma

Marco204
Explorer

Well, that was pretty straight forward @PickleRick 🙂

So I was able to do it within the SPL:

mainsearch | eval mvExtractedParam=split(extractedParam, ",")

And I was able to create a field transformation using "extractedParam" as the value for Source Key and the easy Regular expression:

(?<mvExtractedParam>\w+)

Thanks a lot,
Marco

PS: never forget to create a field extraction that uses the field transformation, just for the purpose of enabling it...

0 Karma
Get Updates on the Splunk Community!

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...