Splunk Search

How can I use Regex to extract Windows SMB Logs?

kleber_silva
Engager

Hi Splunkers

I need to extract this log below each SMB Path to make a count:

LOG Example:

Here are the SMB shares available on the remote host when logged in as "user account"

  • ADMIN$
  • IPC$
  • Teste
  • Users

I need results came with below :

Action = Here are the SMB shares available on the remote host when logged in a
User = "user account"
Path = ADMIN$
Path = IPC$

Path = Teste
Path = Users

I tried using regex but I can only bring all path together.

Thanks for Help

0 Karma
1 Solution

493669
Super Champion

try this rex:
It might need some sort of modification...but at least it will give you idea...

...|rex  field=_raw "(?s).*\"\s+(?<Action>.*)as\s*(?<User>[^:]+)"|rex max_match=0 field=raw "\s*(?<Path>\w+)\$*[\r\n]\s+"

View solution in original post

0 Karma

493669
Super Champion

try this rex:
It might need some sort of modification...but at least it will give you idea...

...|rex  field=_raw "(?s).*\"\s+(?<Action>.*)as\s*(?<User>[^:]+)"|rex max_match=0 field=raw "\s*(?<Path>\w+)\$*[\r\n]\s+"
0 Karma

micahkemp
Champion

Can you include the raw event in your question? If the above represents the raw event, please use the code button (101010) to format it to make it more easy to work with.

0 Karma

kleber_silva
Engager

Following below @micahkemp thanks for help

"10395","","","None","cmp-00002","tcp","445","Microsoft Windows SMB Shares Enumeration","It is possible to enumerate remote network shares.","By connecting to the remote host, windows was able to enumerate the
network share names.","n/a","","
Here are the SMB shares available on the remote host when logged in as user.account:

  • ADMIN$
  • IPC$
  • Teste
  • Users "
0 Karma
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!

Event Series May & June: From Network Visibility to Service Intelligence

Unifying the Network: Moving from Alert Noise to Service Intelligence with Splunk ITSI In today’s hybrid ...

Global Splunk User Group Events: May + June 2026

Your Splunk Community Awaits: Discover Upcoming User Group Events Worldwide    Staying ahead in the fast-paced ...

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...