[syslog-ng] Injecting environment variables?

jetjnkr at gmail.com jetjnkr at gmail.com
Tue Sep 23 18:57:53 CEST 2014


Ok sorry, but still struggling a bit with this:


Running with the following version

syslog-ng 3.2.5
Installer-Version: 3.2.5
Revision: ssh+git://bazsi@git.balabit//var/scm/git/syslog-ng/syslog-ng-ose--mainline--3.2#master#9d4bea28198bd731df1a61e980a2af5b88d81116
Compile-Date: Jan 15 2012 19:47:30
Enable-Threads: on
Enable-Debug: off
Enable-GProf: off
Enable-Memtrace: off
Enable-Sun-STREAMS: off
Enable-IPv6: on
Enable-Spoof-Source: on
Enable-TCP-Wrapper: on
Enable-SSL: off
Enable-SQL: on
Enable-Linux-Caps: off
Enable-Pcre: on
Enable-Pacct: off


I've attempted a number of variations - all have made me sad.....


               template t_cust { template("CUST $CUST"); };
               destination d_web_call      { file("/var/log/web_call" template("<$PRI> $DATE $HOST $MSG template($t_cust) \n") template_escape(no)); };

or 'backtick'....

              destination d_web_call      { file("/var/log/web_call" template("<$PRI> $DATE $HOST $MSG `$CUST` \n") template_escape(no)); };

or...

              destination d_web_call      { file("/var/log/web_call" template("<$PRI> $DATE $HOST $MSG  Template("template $CUST")` \n") template_escape(no)); };



$CUST is definitely defined in the environment but the logs don't have any value appended....


Any further guidance appreciated....


On Sep 23, 2014, at 6:00 AM, syslog-ng-request at lists.balabit.hu wrote:

> ----------------------
> 
> Message: 1
> Date: Mon, 22 Sep 2014 20:10:17 +0200
> From: Balazs Scheidler <bazsi77 at gmail.com>
> Subject: Re: [syslog-ng] Injecting environment variables?
> To: "Syslog-ng users' and developers' mailing list"
> 	<syslog-ng at lists.balabit.hu>
> Message-ID:
> 	<CAKcfE+a8ohm9rbAjyiBbHSs37iyE_mdP=SRU_Cgz_BSAccFFBg at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
> 
> It came in with blocks and scl support. So if your version has support for
> the system driver it will support this as well. My memories are vague with
> 3.2.
> 
> Environment variables are resolved at parsing time and should work like
> this:
> 
> Template("template ?envvar?")
> 
> It works as if the environment variable was right there in the config file.
> On Sep 21, 2014 3:14 PM, <jetjnkr at gmail.com> wrote:
> 
>> Balazs,
>> 
>> Thanks,  do you have any examples in using the backtick it in a message
>> template?  Do you have to assign it to a config variable in a "define"
>> first?
>> 
>> How much 'earlier' versions of syslog-ng  will this work (e.g. before 3.2
>> ?)
>> 
>> Jim.
>> 
>> 
>>> 
>>> 
>>> From: Balazs Scheidler <bazsi77 at gmail.com>
>>> Subject: Re: [syslog-ng] Injecting environment variables?
>>> To: "Syslog-ng users' and developers' mailing list"
>>>      <syslog-ng at lists.balabit.hu>, wernli at in2p3.fr
>>> Message-ID:
>>>      <
>> CAKcfE+ZKqqPnPOOSJek81eq_EPa7y3jUrPyKYH94jc3mxvPsmg at mail.gmail.com>
>>> Content-Type: text/plain; charset="utf-8"
>>> 
>>> Earlier you could use the backtick env variable format.
>>> 
>>> This one is substituted at config parsing.
>>> On Sep 18, 2014 5:26 PM, "Fabien Wernli" <wernli at in2p3.fr> wrote:
>>> 
>>>> Hi Jim,
>>>> 
>>>> As of version 3.5 you can use the `env` template function:
>>>> 
>>>> template("<$PRI> $DATE $HOST $MSG $(env <environment-variable>) \n")
>>>> template_escape(no));
>>>> 
>>>> Cheers
>>>> 
>>>> 
>>>> 
>> ______________________________________________________________________________
>>>> Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
>>>> Documentation:
>>>> http://www.balabit.com/support/documentation/?product=syslog-ng
>>>> FAQ: http://www.balabit.com/wiki/syslog-ng-faq
>>>> 
>>>> 
>>> -------------- next part --------------
>>> An HTML attachment was scrubbed...
>>> URL:
>> http://lists.balabit.hu/pipermail/syslog-ng/attachments/20140920/c41f4430/attachment.html
>>> 
>>> ------------------------------
>>> 
>>> _______________________________________________
>>> syslog-ng maillist  -  syslog-ng at lists.balabit.hu
>>> https://lists.balabit.hu/mailman/listinfo/syslog-ng
>>> 
>>> 
>>> End of syslog-ng Digest, Vol 113, Issue 11
>>> ******************************************
>> 
>> 
>> ______________________________________________________________________________
>> Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
>> Documentation:
>> http://www.balabit.com/support/documentation/?product=syslog-ng
>> FAQ: http://www.balabit.com/wiki/syslog-ng-faq
>> 
>> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://lists.balabit.hu/pipermail/syslog-ng/attachments/20140922/96e24add/attachment.html 
> 
> ------------------------------
> 
> _______________________________________________
> syslog-ng maillist  -  syslog-ng at lists.balabit.hu
> https://lists.balabit.hu/mailman/listinfo/syslog-ng
> 
> 
> End of syslog-ng Digest, Vol 113, Issue 14
> ******************************************



More information about the syslog-ng mailing list