[syslog-ng] patch for syslog-ng-2.0.4 to handle missing files in "follow" mode

Charles G Waldman cgw at hep.uchicago.edu
Thu Jun 7 18:59:14 CEST 2007


The new "follow_freq" feature is nice, because you no longer have to do
things like "tail -f | logger" to get external logfiles into syslog-ng.

However, one case is not handled gracefully, and this is the case when
a log file is not present when syslog-ng starts up.  In this case, an
error is reported, and the file is dropped from the list of sources.
It is possible that the file just hasn't been created yet, because
syslog-ng is starting before some other server which creates the file.

The attached patch modifies the startup behavior, so that if an input
file is nonexistent and follow mode is enabled (i.e. follow_freq > 0),
then the open is "deferred" - a log reader object is created with a
file descriptor set to -1, and the existing logic is used to periodically
check if the file comes into existence:  conceptually, it looks basically
like a file move, where the file is being moved from non-existence into
existence :-)

Patch attached... comments welcome.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: syslog-ng-file-source.patch
Type: text/x-patch
Size: 3041 bytes
Desc: not available
Url : http://lists.balabit.hu/pipermail/syslog-ng/attachments/20070607/6ebc34ab/syslog-ng-file-source.bin


More information about the syslog-ng mailing list