leigh
December 20, 2016, 1:22pm
1
Hi,
We are using Env Vars in our metricbeat.yml file but they are not getting picked up when restarting the service. Metricbeat 5.1.1.
This is basically the same question as answered here:
I have built a custom made beats based on libbeat and I want to use environment variable as a value in the config file. However, if I type ${VAR} in the config file and I run config test, I got:
./countbeat -c countbeat.yml --configtest
Exiting: error unpacking config data: missing field accessing 'name' (source:'countbeat.yml')
I tried in line of configuring the name of the shipper:
name: "${HOSTNAME}"
And it works if I change it into a static string:
name: "a_name"
I have tried to use t…
But...we are exporting the Env Var just before restarting the service and doing this under root (same user that metricbeat service is running under).
fields:
field1: ${THEFIELD}```
```sudo su
export THEFIELD=thevalue
service metricbeat restart```
>Exiting: error unpacking config data: missing field accessing 'fields.field1' (source:'/etc/metricbeat/metricbeat.yml')
...fail!
Any ideas?
steffens
(Steffen Siering)
December 21, 2016, 12:51pm
2
is the service
command really picking up environment variables? Looks like service
is actually dropping environment variables when starting daemons.
leigh
January 5, 2017, 12:40pm
3
Thanks Steffen you are right. I misunderstood the behaviour of the service
command. The metricbeat doc states
After changing the value of an environment variable, you need to restart Metricbeat to pick up the new value.
What is best practice for restarting Metricbeat if we cannot use the service
command?
steffens
(Steffen Siering)
January 5, 2017, 2:06pm
4
I wouldn't use an environment variable here. The problem with service startup is, is your environment variable already available by init-process (most likely not).
Either update your config file or the startup script.
See google
system
(system)
Closed
January 10, 2017, 1:22pm
5
This topic was automatically closed after 21 days. New replies are no longer allowed.