[syslog-ng] Syslog-ng and External variables

Evan Rempel erempel at uvic.ca
Mon Aug 29 17:38:53 CEST 2016


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 at 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 at uvic.ca
Senior Systems Administrator                        250.721.7691
Data Centre Services, University Systems, University of Victoria

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.balabit.hu/pipermail/syslog-ng/attachments/20160829/89ae2701/attachment.htm 


More information about the syslog-ng mailing list