Getting Data In

Dynamically Extract Fields at Search-Time

nateloepker
Explorer

Hello,

I'm trying to dynamically set some extractions to save myself time and effort from writing hundreds of extractions.

In my orgs IdAM solution, we have hundreds of various user claims.

ie)

 Data={"Claims":{"http://wso2.org/claims/user":"username","http://wso2.org/claims/role":"user_role",...etc}

I would like to set up a single extraction that will extract all of these claims.

My idea was the following

props.conf

EXTRACT-nrl_test = MatchAllClaims

transforms.conf

[MatchAllClaims]
FORMAT = user_$1::$2
REGEX = \"http:\/\/wso2.org\/claims\/(\w+)\":\"([^\"]+)
MV_ADD = true

 

I was hoping this would extract the field dynamically, but it did not work.

is there a way to accomplish this with one extraction?

 

Thank you

Labels (3)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @nateloepker ,

your data seems to have a json format, did you tried using INDEXED_EXTRACTIONS = json in your sourcetype definition oer the spath command (https://docs.splunk.com/Documentation/Splunk/9.2.1/SearchReference/Spath)?

Ciao.

Giuseppe

0 Karma

nateloepker
Explorer

hey @gcusello ,

JSON extractions will not work for this. The full event is not in JSON, only the data portion

example event (without all of the claims)...

TID: [-1234]  [2024-05-21 17:40:35,777] [asdf-asdf-asdf-asdf-asdf ] INFO {AUDIT_LOG} - Initiator=initiator Action=action Target=target Data= {"Claims":{ "http://wso2.org/claims/username":"user", "http://wso2.org/claims/role":"role"}}

0 Karma

richgalloway
SplunkTrust
SplunkTrust

EXTRACT props do not invoke a transform.  Use REPORT, instead.

---
If this reply helps you, Karma would be appreciated.

nateloepker
Explorer

Thank you, good catch. Not sure how I messed that up.

I have corrected that error now, but I still do not get multiple fields extracted from this single extraction.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...