Environment variable in filebeat


(sockaddr_in) #1

Hello everyone,
Filebeat version: 5.5
I used environment variable in filebeat config, but it report the error as following:

filebeat2017/08/18 12:34:40.994010 beat.go:339: CRIT Exiting: error loading config file: yaml: line 21: did not find expected '-' indicator
Exiting: error loading config file: yaml: line 21: did not find expected '-' indicator

My filebeat config as following, the LOG_PATH is environment variable i used:

- input_type: log
# Paths that should be crawled and fetched. Glob based paths.
paths:
- '${LOG_PATH}'/access.log
fields:
type: access
business: nginx
fields_under_root: true

So what's the reason? That dose not support this syntax?


(Steffen Siering) #2

The error message is not about the environment variable. The configuration file must be valid yaml.

When starting filebeat via systemd or init script, your environment variable is normally not forwarded to filebeat.


(sockaddr_in) #3

Right, thank you,
I solved this problem by modify - ‘${LOG_PATH}’/access.log to - ‘${LOG_PATH}/access.log'.


(system) #4

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