<p dir="ltr">You don't need the dollar sign within backticks.</p>
<div class="gmail_quote">On Sep 23, 2014 6:58 PM, <<a href="mailto:jetjnkr@gmail.com">jetjnkr@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ok sorry, but still struggling a bit with this:<br>
<br>
<br>
Running with the following version<br>
<br>
syslog-ng 3.2.5<br>
Installer-Version: 3.2.5<br>
Revision: ssh+git://bazsi@git.balabit//var/scm/git/syslog-ng/syslog-ng-ose--mainline--3.2#master#9d4bea28198bd731df1a61e980a2af5b88d81116<br>
Compile-Date: Jan 15 2012 19:47:30<br>
Enable-Threads: on<br>
Enable-Debug: off<br>
Enable-GProf: off<br>
Enable-Memtrace: off<br>
Enable-Sun-STREAMS: off<br>
Enable-IPv6: on<br>
Enable-Spoof-Source: on<br>
Enable-TCP-Wrapper: on<br>
Enable-SSL: off<br>
Enable-SQL: on<br>
Enable-Linux-Caps: off<br>
Enable-Pcre: on<br>
Enable-Pacct: off<br>
<br>
<br>
I've attempted a number of variations - all have made me sad.....<br>
<br>
<br>
template t_cust { template("CUST $CUST"); };<br>
destination d_web_call { file("/var/log/web_call" template("<$PRI> $DATE $HOST $MSG template($t_cust) \n") template_escape(no)); };<br>
<br>
or 'backtick'....<br>
<br>
destination d_web_call { file("/var/log/web_call" template("<$PRI> $DATE $HOST $MSG `$CUST` \n") template_escape(no)); };<br>
<br>
or...<br>
<br>
destination d_web_call { file("/var/log/web_call" template("<$PRI> $DATE $HOST $MSG Template("template $CUST")` \n") template_escape(no)); };<br>
<br>
<br>
<br>
$CUST is definitely defined in the environment but the logs don't have any value appended....<br>
<br>
<br>
Any further guidance appreciated....<br>
<br>
<br>
On Sep 23, 2014, at 6:00 AM, <a href="mailto:syslog-ng-request@lists.balabit.hu">syslog-ng-request@lists.balabit.hu</a> wrote:<br>
<br>
> ----------------------<br>
><br>
> Message: 1<br>
> Date: Mon, 22 Sep 2014 20:10:17 +0200<br>
> From: Balazs Scheidler <<a href="mailto:bazsi77@gmail.com">bazsi77@gmail.com</a>><br>
> Subject: Re: [syslog-ng] Injecting environment variables?<br>
> To: "Syslog-ng users' and developers' mailing list"<br>
> <<a href="mailto:syslog-ng@lists.balabit.hu">syslog-ng@lists.balabit.hu</a>><br>
> Message-ID:<br>
> <CAKcfE+a8ohm9rbAjyiBbHSs37iyE_mdP=<a href="mailto:SRU_Cgz_BSAccFFBg@mail.gmail.com">SRU_Cgz_BSAccFFBg@mail.gmail.com</a>><br>
> Content-Type: text/plain; charset="utf-8"<br>
><br>
> It came in with blocks and scl support. So if your version has support for<br>
> the system driver it will support this as well. My memories are vague with<br>
> 3.2.<br>
><br>
> Environment variables are resolved at parsing time and should work like<br>
> this:<br>
><br>
> Template("template ?envvar?")<br>
><br>
> It works as if the environment variable was right there in the config file.<br>
> On Sep 21, 2014 3:14 PM, <<a href="mailto:jetjnkr@gmail.com">jetjnkr@gmail.com</a>> wrote:<br>
><br>
>> Balazs,<br>
>><br>
>> Thanks, do you have any examples in using the backtick it in a message<br>
>> template? Do you have to assign it to a config variable in a "define"<br>
>> first?<br>
>><br>
>> How much 'earlier' versions of syslog-ng will this work (e.g. before 3.2<br>
>> ?)<br>
>><br>
>> Jim.<br>
>><br>
>><br>
>>><br>
>>><br>
>>> From: Balazs Scheidler <<a href="mailto:bazsi77@gmail.com">bazsi77@gmail.com</a>><br>
>>> Subject: Re: [syslog-ng] Injecting environment variables?<br>
>>> To: "Syslog-ng users' and developers' mailing list"<br>
>>> <<a href="mailto:syslog-ng@lists.balabit.hu">syslog-ng@lists.balabit.hu</a>>, <a href="mailto:wernli@in2p3.fr">wernli@in2p3.fr</a><br>
>>> Message-ID:<br>
>>> <<br>
>> <a href="mailto:CAKcfE%2BZKqqPnPOOSJek81eq_EPa7y3jUrPyKYH94jc3mxvPsmg@mail.gmail.com">CAKcfE+ZKqqPnPOOSJek81eq_EPa7y3jUrPyKYH94jc3mxvPsmg@mail.gmail.com</a>><br>
>>> Content-Type: text/plain; charset="utf-8"<br>
>>><br>
>>> Earlier you could use the backtick env variable format.<br>
>>><br>
>>> This one is substituted at config parsing.<br>
>>> On Sep 18, 2014 5:26 PM, "Fabien Wernli" <<a href="mailto:wernli@in2p3.fr">wernli@in2p3.fr</a>> wrote:<br>
>>><br>
>>>> Hi Jim,<br>
>>>><br>
>>>> As of version 3.5 you can use the `env` template function:<br>
>>>><br>
>>>> template("<$PRI> $DATE $HOST $MSG $(env <environment-variable>) \n")<br>
>>>> template_escape(no));<br>
>>>><br>
>>>> Cheers<br>
>>>><br>
>>>><br>
>>>><br>
>> ______________________________________________________________________________<br>
>>>> Member info: <a href="https://lists.balabit.hu/mailman/listinfo/syslog-ng" target="_blank">https://lists.balabit.hu/mailman/listinfo/syslog-ng</a><br>
>>>> Documentation:<br>
>>>> <a href="http://www.balabit.com/support/documentation/?product=syslog-ng" target="_blank">http://www.balabit.com/support/documentation/?product=syslog-ng</a><br>
>>>> FAQ: <a href="http://www.balabit.com/wiki/syslog-ng-faq" target="_blank">http://www.balabit.com/wiki/syslog-ng-faq</a><br>
>>>><br>
>>>><br>
>>> -------------- next part --------------<br>
>>> An HTML attachment was scrubbed...<br>
>>> URL:<br>
>> <a href="http://lists.balabit.hu/pipermail/syslog-ng/attachments/20140920/c41f4430/attachment.html" target="_blank">http://lists.balabit.hu/pipermail/syslog-ng/attachments/20140920/c41f4430/attachment.html</a><br>
>>><br>
>>> ------------------------------<br>
>>><br>
>>> _______________________________________________<br>
>>> syslog-ng maillist - <a href="mailto:syslog-ng@lists.balabit.hu">syslog-ng@lists.balabit.hu</a><br>
>>> <a href="https://lists.balabit.hu/mailman/listinfo/syslog-ng" target="_blank">https://lists.balabit.hu/mailman/listinfo/syslog-ng</a><br>
>>><br>
>>><br>
>>> End of syslog-ng Digest, Vol 113, Issue 11<br>
>>> ******************************************<br>
>><br>
>><br>
>> ______________________________________________________________________________<br>
>> Member info: <a href="https://lists.balabit.hu/mailman/listinfo/syslog-ng" target="_blank">https://lists.balabit.hu/mailman/listinfo/syslog-ng</a><br>
>> Documentation:<br>
>> <a href="http://www.balabit.com/support/documentation/?product=syslog-ng" target="_blank">http://www.balabit.com/support/documentation/?product=syslog-ng</a><br>
>> FAQ: <a href="http://www.balabit.com/wiki/syslog-ng-faq" target="_blank">http://www.balabit.com/wiki/syslog-ng-faq</a><br>
>><br>
>><br>
> -------------- next part --------------<br>
> An HTML attachment was scrubbed...<br>
> URL: <a href="http://lists.balabit.hu/pipermail/syslog-ng/attachments/20140922/96e24add/attachment.html" target="_blank">http://lists.balabit.hu/pipermail/syslog-ng/attachments/20140922/96e24add/attachment.html</a><br>
><br>
> ------------------------------<br>
><br>
> _______________________________________________<br>
> syslog-ng maillist - <a href="mailto:syslog-ng@lists.balabit.hu">syslog-ng@lists.balabit.hu</a><br>
> <a href="https://lists.balabit.hu/mailman/listinfo/syslog-ng" target="_blank">https://lists.balabit.hu/mailman/listinfo/syslog-ng</a><br>
><br>
><br>
> End of syslog-ng Digest, Vol 113, Issue 14<br>
> ******************************************<br>
<br>
______________________________________________________________________________<br>
Member info: <a href="https://lists.balabit.hu/mailman/listinfo/syslog-ng" target="_blank">https://lists.balabit.hu/mailman/listinfo/syslog-ng</a><br>
Documentation: <a href="http://www.balabit.com/support/documentation/?product=syslog-ng" target="_blank">http://www.balabit.com/support/documentation/?product=syslog-ng</a><br>
FAQ: <a href="http://www.balabit.com/wiki/syslog-ng-faq" target="_blank">http://www.balabit.com/wiki/syslog-ng-faq</a><br>
<br>
</blockquote></div>