Getting Data In

DNS lookup failing

huaraz
Explorer

Hi

I read http://www.splunk.com/base/Documentation/4.2.2/Knowledge/Addfieldsfromexternaldatasources and see my default transform.conf has

# Example external lookup

[dnslookup]

external_cmd = external_lookup.py clienthost clientip

fields_list = clienthost clientip

But when I try to use it I get "Error in 'lookup' command: Could not find all of the specified lookup fields in the lookup table."

I use:
"Local User:" AND NOT DNS AND NOT close | rex field=_raw "User:\s+(?.):.\s+->\s+(?.*):" | top limit 20 dst | lookup dnslookup dst

The logfile entries look like:

Aug 25 23:00:22 Vigor: Local User: 192.168.1.8:50829 -> 22.58.244.67:80 (TCP)Web

Thank you
Markus

Tags (1)
0 Karma

LeedhamB_80746
Engager

I encountered a similar issue with syntax, which the posts above helped me solve. I'm documenting the "why" as to the failed resolution for future reference.

Initially I was submitting a search similar to:
ClientIP="8.8.8.8" | lookup dnslookup ClientIP

Results in error:
"Error in 'lookup' command: Could not find all of the specified lookup fields in the lookup table"

Within the dnslookup script, clientip and clienthost:
1) are case sensitive
2) set forward or reverse dns resolution
3) are preconfigured in the dnslookup script
4) are required for dnslookup to function

These variables set functionality for forward or reverse dns resolution as flags/switches that must be present for the lookup to function correctly. The command "AS ___" actually passes the field/variable to the dnslookup script for resolution.

Correct lookup examples (with comparisons):
Resolve-dns.ps1 -f "google[.]com"
ClientHost="google[.]com" | lookup dnslookup clienthost AS ClientHost

Resolve-dns.ps1 -r "8.8.8.8"
ClientIP="8.8.8.8" | lookup dnslookup clientip AS ClientIP

pryzrak
Path Finder

The search below is another option:

<search> | lookup dnslookup clientip as dst | fillnull value=unknown

Just get rid of your two 'eval's.

0 Karma

lrhazi
Path Finder

Looks like you needed: lookup dnslookup clientip as dst

huaraz
Explorer

I think I found the answer myself. I have to use the fields which are listed in the transform.conf.

"Local User:" AND NOT DNS AND NOT close | rex field=_raw "User:s+(?.):.s+->s+(?.*):" | top limit 20 dst | eval clientip=dst | eval clienthost="unknown" | lookup dnslookup clientip

Markus

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!

Where Innovation Takes Flight: The Splunk4Aviation Flight Sim Lands at .conf26

If you hear someone at .conf26 shouting "gear down, GEAR DOWN" across the show floor, you have found us.  The ...

Turn Cisco Telemetry Into Action with Cisco Data Fabric, powered by the Splunk ...

The surge in machine data is already hitting enterprise budgets, and the agentic era will only intensify it. ...

Persistent Queue at TcpOut — One of Splunk's Most Practical Features

Splunk introduced persistent queueing at the tcpout layer as one of the most practical resilience features in ...