All Apps and Add-ons

Extract 65-char string between forward slashes?

pcorchary
Explorer

I've been trying to extract a field 'user_id' from lines like below. The field will always be 65 char long alphanumeric and usually be between forward slashes. (there is one case where it is in single quotes with text before and after.) I dont think there are any other 65-char strings to generate false positives.

This ...

(?P<FIELDNAME>\/[a-z0-9A-Z]{65}\/) 

isn't getting it ... can some REX guru tell me what I'm doing wrong, please? 🙂

Jan 8 08:07:12 storage-bpmpgbhp8xqbr uwsgi_storage: [08/Jan/2014:08:07:12 +0000] [10.0.0.0] [10.0.0.0] [200] [HTTP/1.1] [GET] [11] [881] [/1b1c360a515100881ecc97ed9c9c3767ff0b708925788efded2602514342b7c4/files/] [] [] [curl/7.33.0]
Jan 8 08:07:12 storage-pouwb84yj8ytc uwsgi_storage: [08/Jan/2014:08:07:12 +0000] [10.0.0.0] [10.0.0.0] [404] [HTTP/1.1] [GET] [7] [51] [/9030e295eb8cbcdb0384ee52ab0ac688e2e23c9c95a5ceb6fa1edcc3097d887b/appdata/thumbnail/c8b626e8-15dd-4990-8d4c-d9b99624a9c3?width=64&height=64] [] [] [-]
Jan 8 08:07:11 storage-7fcoekg7uk4wr uwsgi_storage: [08/Jan/2014:08:07:11 +0000] [10.0.0.0] [10.0.0.0] [404] [HTTP/1.1] [GET] [5] [51] [/9030e295eb8cbcdb0384ee52ab0ac688e2e23c9c95a5ceb6fa1edcc3097d887b/appdata/thumbnail/902aeb1c-af8f-42d0-b2e8-9f59c3a051c4?width=64&height=64] [] [] [-]

0 Karma

gfuente
Motivator

Try this reg ex:

\[\/(?<field>\w{64})\/

Regards

MuS
SplunkTrust
SplunkTrust

small update on the regex, this will not include the \/ in the value of field:

(?\w{64})

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...