Getting Data In

How to strip the FQDN from an inputs.conf monitor path using host_segment?

jking81
Engager

I have files on multiple servers that I need to log that are housed in a directory where the path includes the system's hostname. The issue I'm dealing with is I only want the first portion of the hostname.

For example, if my hostname is set to db01.awesomesite.com, the path I'm attempting to monitor would be /var/log/stuff/db01/otherstuff.log

I've attempted this to no avail:

[monitor:///var/log/stuff/*/otherstuff.log]
host_segment = 4
sourcetype = awesome_sourcetype
index = awesome_index
disabled = false

Changing the host in the Universal Forwarder config isn't acceptable as I need to maintain the full host in my Splunk host field.

0 Karma

nnmiller
Contributor

A simple solution: set up symlinks with the short names, and monitor those file paths with Splunk rather than the ones with the FQDN. You will just need to ensure the symlink is created before a host starts sending data.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...