[syslog-ng] Set log directory based on the source

Frank DiGennaro frank at digennaro.com
Thu Jan 30 16:25:26 UTC 2020


Hello;

    I'm somewhat of a newbie when it comes to syslog-ng so forgive me if the
question is somewhat basic. I am running syslog-ng 3.25 on both server and
clients and would like to set a variable based on the source. This is what I
have:

 

@define server-logdir "/var/log"

@define client-logdir "/var/log/CLIENTS/$YEAR/$MONTH_ABBREV/$DAY/$HOST"

@define logdir ""

 

source s_local { 

    logdir `server-logdir`;  *No!

    ...

    ...

};

source s_network { 

    logdir `client-logdir`;  *No!

    ...

    ...

};

destination d_local0 {

    file( "`logdir`/local/local0.log" );

};

 

The goal is to set 'logdir' to either 'server-logdir' or 'client-logdir' and
use it in the destination. I know there are probably several ways that this
can be accomplished but I think this was will cut down on the number of
lines in the configuration. So my question

Is this. How do I set 'logdir' to either 'server-logdir' or 'client-logdir'
in the source definition?

Thanks;

 

DiGennaro

Frank DiGennaro

301-676-8193 (C)

 <mailto:frank at digennaro.com> frank at digennaro.com

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.balabit.hu/pipermail/syslog-ng/attachments/20200130/f4ba1d41/attachment.html>


More information about the syslog-ng mailing list