[syslog-ng] composing file names with system varible

Balazs Scheidler bazsi at balabit.hu
Sat Mar 6 10:33:57 CET 2010


On Wed, 2010-03-03 at 12:56 -0700, Patrick H. wrote:
> No, you can not do anything like that. You can hack something really
> ugly using the program() output driver and feed it back into
> syslog-ng, but that'll be slow and ugly. Though its the only option.

perhaps running the configuration file through sed would work though.
Maybe using the include feature.

E.g. 

syslog-ng.conf:

include 'rewrite-hostname.conf'

rewrite-hostname.conf.in:

rewrite r_hostname { set("@MYHOSTNAME@" value("HOSTNAME")); };

sed script to turn rewrite-hostname.conf.in to rewrite-hostname.conf:

sed -e "s/@MYHOSTNAME@/$(cat /var/hostname)/g" < rewrite-hostname.conf.in > rewrite-hostname.conf

and then put this sed magic in your syslog-ng init script
(or /etc/default/syslog-ng which is included by the init script)

-- 
Bazsi




More information about the syslog-ng mailing list