Splunk Search

Rex for drive letters

nashia
New Member

I only want to look at built in shares like A$-Z$, but not ADMIN$ or IPC$. Is there a rex expression that will allow me to do this?

rex field=share_name "(?[a-zA-Z]{1}+)\$+" works similarly, where I get A$, C$, D$, G$, etc; but it will also give me C$ from the end of IPC$ and N$ from the end of ADMIN$.

I guess what I need is to first only rex if there are two characters (letter + $)... Any help is appreciated.

Tags (2)
0 Karma

FrankVl
Ultra Champion

What is in the share_name field? Just the short name, or a full url like \servername\c$?

0 Karma

harsmarvania57
Ultra Champion

Hi,

Please try below regex

| rex field=share_name "^(?<drive>[a-zA-Z]\$)"
0 Karma

nashia
New Member

Hi, Thank you for your answer; unfortunately it does not work.

0 Karma

FrankVl
Ultra Champion

Can you be a bit more specific than "it does not work"?

0 Karma

FrankVl
Ultra Champion

Second z should be Z I guess? 😉

But yes, that should do the trick. If the share_name contains a full UNC path, try "\\(?<drive>[a-zA-Z]\$)"

harsmarvania57
Ultra Champion

Thanks for pointing this. 🙂

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