Cannot use env variables in filebeat!


(Wang Yaohua) #1

My filebeat version is 5.5.0 and OS is CentOS7
###The config as following:

filebeat.prospectors:
- input_type: log
  paths:
    - /var/log/xaa
  fields:
    docker: ${HOSTNAME}
  fields_under_root: true
  document_type: nginx
  tags: test

[root@vm1 ~]# env|grep HOSTNAME
HOSTNAME=vm1

but the filebeat cann't work.
##The log output

CRIT Exiting: error loading states for prospector 8734646245685621701: missing field accessing 'filebeat.prospectors.0.fields.docker' (source:'/etc/filebeat/filebeat.yml')

The filebeat is working when I change the ${HOSTNAME} to ${HOSTNAME:default_value},But it's error when I change the ${HOSTNAME} to ${HOSTNAME:?default_value}.


(Wang Yaohua) #2

I got it.
I execute the systemctl import-environment the filebeat is working


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.