I do this by adding the following to my config file

@module confgen context(rewrite) name(r_myself) exec("/bin/hostname")

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

log {
        source(s_your_source);
        rewrite(r_local);
        destination(d_your_destination);
};





hope that helps.



On 08/29/2016 06:35 AM, Robert Blayzor wrote:
On Aug 29, 2016, at 9:22 AM, Fabien Wernli <wernli@in2p3.fr> wrote:
The backticks replace content, so you end up with a literal in your config.
Try this instead:

   rewrite r_host { set("`HOSTNAME`", value("HOST")); };

That certainly fixes the config from complaining, but I now just get an empty string; for which syslog-ng replaces with the hosts IP instead.

I’m just trying to re-write each messages host with the hostname of the current server.


______________________________________________________________________________
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



-- 
Evan Rempel                                      erempel@uvic.ca
Senior Systems Administrator                        250.721.7691
Data Centre Services, University Systems, University of Victoria