Environment variables in syslog
Hellow, Please see below the snippet from my syslog-ng.conf file. ABC_LOG_PATH is the environment variable on the host that contains the path. I am trying to access the env variable within the config. It does not throw any error and the configuration is valid but it does not work properly. I don't see the file agent.log being used at all. source s_agent { file("`ABC_LOG_PATH`/agent.log" follow-freq(1) flags(no-parse)); }; root@syslog-ng-784fdc497-pgdzr:/# syslog-ng --version syslog-ng 3 (3.30.1) Config version: 3.29 Installer-Version: 3.30.1 Revision: Compile-Date: Apr 12 2022 20:15:37 Module-Directory: /usr/lib/syslog-ng Module-Path: /usr/lib/syslog-ng Include-Path: /usr/share/syslog-ng/include Available-Modules: add-contextual-data,afamqp,affile,afprog,afsocket,afsql,afstomp,afuser,appmodel,azure-auth-header,basicfuncs,cef,confgen,cryptofuncs,csvparser,dbparser,disk-buffer,graphite,hook-commands,http,json-plugin,kvformat,linux-kmsg-format,map-value-pairs,mod-python,pseudofile,redis,secure-logging,stardate,syslogformat,system-source,tags-parser,timestamp,xml Enable-Debug: off Enable-GProf: off Enable-Memtrace: off Enable-IPv6: on Enable-Spoof-Source: off Enable-TCP-Wrapper: off Enable-Linux-Caps: off Enable-Systemd: off root@syslog-ng-784fdc497-pgdzr:/# uname -a Linux syslog-ng-784fdc497-pgdzr 4.18.0-147.3.1.el8_1.x86_64 #1 SMP Fri Jan 3 23:55:26 UTC 2020 x86_64 GNU/Linux root@syslog-ng-784fdc497-pgdzr:/# -- Regards, Faisal
Hi Faisal, Try to use the template function instead: file("$(env 'ABC_LOG_PATH')/agent.log");
participants (2)
-
Fabien Wernli
-
Faisal Chishti