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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...