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!

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to Officially Supported Splunk ...