Splunk Search

How can I match a bearer token after bearer is found in a log?

mgpspr
New Member

Hello,

I'm trying to match a bearer token. How can I match the token after Bearer that is found in a log? Bearer eddc46d4-cc9a-4697-885a-c342ce650a77

Tags (3)
0 Karma

jplumsdaine22
Influencer

It's hard to be sure without seeing your data, but you could try try the following rex command

... | rex field=_raw "Bearer\s(?<bearer_token>[^\s]+) "| table bearer_token

Modify the regex as required based on your data. https://regex101.com/ is a good place to test regex strings.

See http://docs.splunk.com/Documentation/Splunk/6.3.3/SearchReference/Rex

0 Karma

jplumsdaine22
Influencer

Are you trying to search for a specific token or extract the value of bearer ?

0 Karma

mgpspr
New Member

Extract the value of the tokens after the word Bearer

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...