On this system, imagine that there is a program that detects whether or not it is day or night and sets and environment variable DAY. My environment variable DAY is picked up and used in this working fragment:
log {
source {
file("/var/log/special/xxx" flags(no-parse) );
};
destination {
file("/var/log/special/yyy" template("`DAY` $MESSAGE\n"));
};
};
But eventually I'll need to change DAY to "night". I experimented with global variables, but those are not retained between log messages nor can you use a rewrite rule and set DAY
.
I think I could write a script that would run when it got dark that would update /etc/profile.d/day.csh
setenv DAY night
and do a systemctl restart syslog-ng
Wouldn't that put me at risk of losing some log messages? I am writing to tcp() and amqp() destinations that I would image would get aborted.
Would it be better to HUP it?
Is there an approach I missed?