Splunk Dev

Dealing with hostnames difference and Lookups in Splunk

jmcclure
Explorer

I have an issue where my hostnames coming in (mostly from Windows) are full domain name and some are the alias

hostname vs hostname.domain.com

I have lookups that I need to have just the alias. How can I get Splunk to give me just the alias.

Am I going to have to go through the Windows TA and fix all the regexes?

Tags (1)
0 Karma

aholzer
Motivator

There's a couple of things you can do:

1) At search time you can add the following (assuming it's your host field that contains the fully qualified domain name):

<base_search>
| rex field=host "^(?P<hostname>[^\.]+)" 
| eval hostname=lower(hostname)

Then you can use the new field "hostname" to do your check against your lookup.

2) Otherwise you can define a "calculated field" to extract the value out of the fully qualified domain name field:

   lower(mvindex(split(host,"."),0))

This assumes that your FQDN is stored under field 'host', and it will grab everything up to the first period as the value for whatever field you define.

Hope this helps

Get Updates on the Splunk Community!

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...