Splunk Search

How to Match the First three characters of a MAC address within a lookup table field

leykmekoo
Explorer

Hello, 

I have a lookup table where a list of MAC addresses are listed with the associated Vendors; basically an identifier. However, the mac address in this lookup table (column name is 'prefix') only has the three characters - xx:xx:xx. What I'm trying to do is write a query to find devices that were assigned/renewed an IP address from the DHCP server and based on their Mac address information in the result, identify the vendor. I was able to filter the first three characters from the result but when adding the lookup table to enrich the result with the Vendor information, I'm getting zero results. What am I doing wrong here? Thanks in advance! 

index=some_dhcp description=renew

| eval d_mac=dest_mac

| rex field=d_mac "(?P<d_mac>([0-9-Fa-f]{2}[:-]){3})"

| lookup vendor.csv Prefix as d_mac OUTPUT Prefix Vendor_Name

| search Prefix=*

| table date dest_mac Vendor_Name description
Labels (2)
0 Karma
1 Solution

bowesmana
SplunkTrust
SplunkTrust

Does your lookup definition contain nnn* or just nnn - to use wildcard, the lookup itself should have an asterisk

View solution in original post

bowesmana
SplunkTrust
SplunkTrust

Does your lookup definition contain nnn* or just nnn - to use wildcard, the lookup itself should have an asterisk

leykmekoo
Explorer

Adding a wildcard to a 1000+ lookup table was a pain 😶 but that seems to resolve the issue i was having. 😊😊 It's a good lesson as well. Thank you and everyone for your recommendations!! 

0 Karma

bowesmana
SplunkTrust
SplunkTrust

@leykmekoo A tip for the future 😀

| inputlookup your_lookup
| eval your_wildcard_field=your_wildcard_field."*"
| outputlookup your_lookup

 

leykmekoo
Explorer

Great! Thanks! 

0 Karma

yuanliu
SplunkTrust
SplunkTrust

Have you set up the Prefix field to match_type WILDCARD? See Share a lookup table file with apps.

0 Karma

leykmekoo
Explorer

Yes, I've created a lookup definition and set the Match type as 'WILDCARD(Prefix)'. However, I'm still not getting results. When commenting out the lookup, I get results. 

0 Karma
Get Updates on the Splunk Community!

Developer Spotlight with Brett Adams

In our third Spotlight feature, we're excited to shine a light on Brett—a Splunk consultant, innovative ...

Index This | What can you do to make 55,555 equal 500?

April 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...

Say goodbye to manually analyzing phishing and malware threats with Splunk Attack ...

In today’s evolving threat landscape, we understand you’re constantly bombarded with phishing and malware ...