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!

Cloud Platform & Enterprise: Classic Dashboard Export Feature Deprecation

As of Splunk Cloud Platform 9.3.2408 and Splunk Enterprise 9.4, classic dashboard export features are now ...

Explore the Latest Educational Offerings from Splunk (November Releases)

At Splunk Education, we are committed to providing a robust learning experience for all users, regardless of ...

New This Month in Splunk Observability Cloud - Metrics Usage Analytics, Enhanced K8s ...

The latest enhancements across the Splunk Observability portfolio deliver greater flexibility, better data and ...