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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...