Splunk Search

How to extract password field in the events with regex? (Password is a string of numbers)

kiran331
Builder

How to extract password field in the events?

I need to extract " 123456-222245-666565-151063-123456-222365-333111-110110" from below sample event. Any ideas?

==========================
BitLocker Drive Encryption: Configuration Tool version 10.0.15063
Copyright (C) 2013 Microsoft Corporation. All rights reserved.
Computer Name: abcde
Volume C: [dfdf]
All Key Protectors
Numerical Password:
ID: {fjkfjsdfsdjfsj,fhndhg}
Password:
123456-222245-666565-151063-123456-222365-333111-110110
TPM:
ID: {vgdsfsdf3D-33dfdsf44F0-A1EBf9A4B88FFF9A8}
PCR Validation Profile:
0, 2, 4, 11
abcde

Thanks
Kiran

Tags (2)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi kiran331,
try this:

(?ms)\}\s+Password:\s+(?<Password>.*)TPM

or

| rex "(?ms)\}\s+Password:\s+(?<Password>.*)TPM"

you can test it at https://regex101.com/r/5Wp6Tw/1

Bye.
Giuseppe

View solution in original post

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi kiran331,
try this:

(?ms)\}\s+Password:\s+(?<Password>.*)TPM

or

| rex "(?ms)\}\s+Password:\s+(?<Password>.*)TPM"

you can test it at https://regex101.com/r/5Wp6Tw/1

Bye.
Giuseppe

0 Karma

sbbadri
Motivator

@kiran331

your search | rex field=_raw "Password:\s+(?P<password>.+)\s+TPM:

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...