[syslog-ng]$HOST $YEAR, etc not working correctly..

Balazs Scheidler syslog-ng@lists.balabit.hu
Thu, 26 Feb 2004 12:49:40 +0100


2004-02-25, sze keltezéssel 21:16-kor Doug Peterson ezt írta:
> --- Balazs Scheidler <bazsi@balabit.hu> wrote:
> > 
> > strange, the problem seems to be that you reference marcos like
> > $YEAR_$MONTH_
> > 
> > which is interpeted as $YEAR_ concatenated with $MONTH_, these are
> > undefined macros, thus are expanded to an empty string.
> > 
> > Try escaping the underscore with a backslash, like
> > 
> > $YEAR\_$MONTH\_
> 
> 
> I escaped out the _ characters, and am still getting the same results with 1.6.2.. files are being
> written as messages_25 (25 being $DAY)
> 
> My rules now look like this:
> 
> destination messages.network {
> file("/var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/messages\_$HOST\_$YEAR\_$MONTH\_$DAY"
>                                 owner(root) group(sysadmin) perm(0640) dir_perm(0700)
> create_dirs(yes) ); };


This definitely works here. syslog-ng uses gperf to generate a lookup
hash for macro names. A generated file is shipped with syslog-ng to
avoid the build dependency on gperf, but maybe it was regenerated for
some reason.

This area had a bug in 1.6.0rc2 (before or after this version should be
ok), are you sure you are running 1.6.2?

-- 
Bazsi
PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1