You should generate the entire set() from within the confgen. That should work. Iirc there was a fix that causes the old one not to work (whereas due to a bug it did work earlier).

If you only want to substitute the argument, you can use a defines, or even an scl that wraps the entire set into a block.


On Feb 18, 2018 06:36, "Evan Rempel" <erempel@uvic.ca> wrote:
I am using the copr RPM build syslog-ng-3.13.2-3.el7.centos.x86_64 on a redhat 7 system.

I am trying to use the confgen to create a value and use it in a rewrite.

I realize that I can use $LOGHOST in this context but am using it as an example.


@module confgen context(rewrite) name(z_myself) exec("/usr/bin/hostname")
rewrite r_local { set( "z_myself()", value("HOST") ); };
log {
        source(local);
        rewrite(r_local);
        destination(d_var_syslog);
};


d_var_syslog is any file destination to capture the log message.


The above configuration actually sets the hostname in the log line to be "z_myself()".

2018-02-17T21:15:39.220-08:00 z_myself() solaris-cron.err erempel: just testing

if I make the rewrite

rewrite r_local { set( z_myself(), value("HOST") ); };


I get syntax errors.

The top example works on redhat 6 with syslog-ng 3.9

I can't find any documentation on how to use a block (confgen) define in a rewrite statement.

I have tried back ticks, $(z_myself()) macros "`z_myself()`" and any other combination but they all result in syslog-ng failing to start.

What am I doing wrong?

Evan.

______________________________________________________________________________
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