Getting Data In

I want to deploy an apps to all forwarder and each forwarder will monitor a specific directory based on environment variable. How to do this?

daniel_splunk
Splunk Employee
Splunk Employee

We have four servers "hostA" through "hostD" which share a common network storage area for log files. Each server has a universal forwarder installed.

Log files within shared storage are named using the short name of the host.

For example,
/shared/hostA_file1.log
/shared/hostB_file2.log

I want to deploy just one app to all forwarder and each forwarder will monitor a specific directory based on environment variable.

I write the inputs.conf like this but not working.

[monitor:///shared/$HOSTNAME_*.log]

Tags (1)
0 Karma

daniel_splunk
Splunk Employee
Splunk Employee

You can set the same variable to your splunk ac environment variable (eg. .bashrc and .bash_profile) to try also.

0 Karma

gschmitz
Path Finder

Would that help in my case? I think in some settings Splunk just doesn't do the substitution 😞

0 Karma

gschmitz
Path Finder

Hi,
I googled for splunk-launch questions and found this post.
I tried to set a variable (the fully qualified domain name and the hostname to be precise), but inputs.conf sets the server name to the literal variable:
Failed to parse timestamp. Defaulting to timestamp of previous event (Tue Feb 3 09:06:35 2015). Context: source::/home/splidx01/var/log/splunk/splunkd_stderr.log|host::$SHORTNAME|splunkd_stderr|41

Same goes for the register_replication_address. Master says
ERROR ClusterMasterPeerHandler - Invalid host name $FQDN

What exactly limits the use of these variables? sslKeysfile in the same file takes the variable just fine...

0 Karma

daniel_splunk
Splunk Employee
Splunk Employee

Splunk don't like the underscore in variable substitution.

You can change the directory structure like this.

/shared/hostA/file1.log
/shared/hostB/file2.log

and the monitoring stanza become.

[monitor:///shared/$HOSTNAME/*.log]

For the environment, you need to set it under
$SPLUNK_HOME/etc/splunk-launch.conf

Set the environment variable from the shell level won't work as Splunk won't read that.

Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

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

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...