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!

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 ...

Splunk Observability for AI

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

[Puzzles] Solve, Learn, Repeat: Dereferencing XML to Fixed-length events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...