All Apps and Add-ons

How to pass environment variables to db_connection.conf (DBconnect version: 3.1.4)

davidgogogo
Explorer

Hi, my Splunk DBconnect version is 3.1.4
I would like to pass the environment variable to the db_connections.conf
but it seems can't work

Passing environment variable is normal when I do the same way in other apps
is it the DBconnet app limitation?

The following is my format:

## splunk-launch.conf
...
SPLUNK_ENV_DB_CONN_ENABLE=1
SPLUNK_ENV_DB_CONN_HOST=localhost

## splunk_app_db_connect/local/db_connections.conf

[myConnection]
connection_type = postgres
database = mydatabase
disabled = $SPLUNK_ENV_DB_CONN_ENABLE
host = $SPLUNK_ENV_DB_CONN_HOST
identity = test
jdbcUseSSL = false
localTimezoneConversionEnabled = false
port = 5432
readonly = true
0 Karma
1 Solution

masonmorales
Influencer

Quoting another answer:

.conf files have a special support for consuming environment variables that depends on the variable expansion ability of the code that reads them. That is, some .conf files will honor an environment variable (such as deploymentclient.conf) while others won't (such as inputs.conf).

View solution in original post

0 Karma

masonmorales
Influencer

Quoting another answer:

.conf files have a special support for consuming environment variables that depends on the variable expansion ability of the code that reads them. That is, some .conf files will honor an environment variable (such as deploymentclient.conf) while others won't (such as inputs.conf).
0 Karma

masonmorales
Influencer

Did you restart Splunk after configuring the environment variables in splunk-launch.conf?

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...