Hi Klaas Thanks very much for the reply and for thinking that this makes sense :) Symlinks are really portable - the symlink() and unlink() system calls are part of the Open Group's UNIX 98 definition (formerly X/Open and 'Spec 1170'), so any UNIX would be able to do this. Less sure about windows, BTW, although Cygwin and U/WIN definitely do support the calls. If I can find the time, I'll have a look at it myself, as I think it's really just a few lines of logic (plus error checking et al): add file options "symlink_cur" and "symlink_pre" at file close() time: if (symlink_cur is set) { unlink(symlink_cur) } if (symlink_pre is set) { symlink(real_file, symlink_pre) } at file open() time: if (symlink_cur is set) { symlink(real_file, symlink_cur) } ...that should about cover it. Never having touched lex & yacc, I've been hesitant to try to touch this code, but it shouldn't be that bad (famous last words :)) Kind regards Jay ===< Klaas van Gend wrote: >===
From: klaas.vangend@philips.com To: syslog-ng@lists.balabit.hu Date: Wed, 26 Jun 2002 09:49:28 +0200 Subject: [syslog-ng]Re: Thinking about linking Reply-To: syslog-ng@lists.balabit.hu
On 2002-06-26 06:25:05 AM syslog-ng-admin wrote:
Message: 4 Date: Tue, 25 Jun 2002 17:06:22 +0200 From: Jay Goldberg <jg@open.ch> To: syslog-ng@lists.balabit.hu Organization: Open Systems AG - http://www.open.ch Gecko/20020530 Subject: [syslog-ng]Thinking about linking Reply-To: syslog-ng@lists.balabit.hu
Hi, syslog-ng'ers
A quick question for all - I've been using syslog-ng, but instead of using the excellent built-in $YEAR $MONTH and $DAY macros for automatic logfile rotation, I've been using a different solution -
I use the cronolog program (www.cronolog.org) as a destination for any files that I want to keep locally. It's not optimal, but it allows me to do one thing that keeps our complex management environment intact after the cutover from syslog to syslog-ng, and that's to maintain a symbolic link to the latest and previous logfiles in the place where folks/scripts would normally think to look for them. So for example:
/reallybigdisk/logs/2002/06/messages.25 and /reallybigdisk/logs/2002/06/messages.24
would be today's and yesterdays 'messages' file. But with cronolog, I'm abl
e
to specify options so that /var/adm/messages is just a symlink to whatever f ile we're logging to now, and /var/adm/messages.0 is a symlink to whatever file we logged to last:
host# ls -l /var/adm/messages* lrwxrwxrwx 1 root root 34 Jun 25 01:16 /var/adm/messages -> /reallybigdisk/logs/2002/06/messages.25 lrwxrwxrwx 1 root root 34 Jun 24 01:16 /var/adm/messages.0 -> /reallybigdisk/logs/2002/06/messages.24
I'm not sure if I missed this in the documentation for syslog-ng or perhaps I'm just insane for thinking that this is useful :)
So I guess my questions after all this are:
- did I miss this in the documentation? - am I insane for wanting such a feature? - would it be a lot of trouble to add this feature?
...I was thinking something along the lines of a 'maintain_symlink' option f or a file destination that takes the target of the symlink (e.g., /var/adm/messages) as an option.
As far as I know (and I've probably been the last person looking over that cod e), there is no such option currently available. It wouldn't be too hard to write, if and only if creating symlinks is portable over all UNIX implementations. Being a Linux&Windows programmer only, I don't know for sure. Anyway, following the lines of my latest patch (the "remove_if_older" patch, s ubmitted Feb1 2002, included in 1.5.15), it shouldn't be too difficult to implement.
I currently don't have time for it, but I think your suggestion makes sense an d maybe I can persuade my boss to give me some time to implement it.
Groetjes,
Klaas van Gend
-- jay goldberg senior engineer open systems ag raeffelstrasse 29 ch-8045 zurich t: +41 1 455 74 00 f: +41 1 455 74 01 jg@open.ch http://www.open.ch
On Thu, Jun 27, 2002 at 09:03:56AM +0200, Jay Goldberg wrote:
Hi Klaas
Thanks very much for the reply and for thinking that this makes sense :)
Symlinks are really portable - the symlink() and unlink() system calls are part of the Open Group's UNIX 98 definition (formerly X/Open and 'Spec 1170'), so any UNIX would be able to do this. Less sure about windows, BTW, although Cygwin and U/WIN definitely do support the calls.
If I can find the time, I'll have a look at it myself, as I think it's really just a few lines of logic (plus error checking et al):
add file options "symlink_cur" and "symlink_pre"
at file close() time: if (symlink_cur is set) { unlink(symlink_cur) } if (symlink_pre is set) { symlink(real_file, symlink_pre) }
at file open() time:
if (symlink_cur is set) { symlink(real_file, symlink_cur) }
...that should about cover it. Never having touched lex & yacc, I've been hesitant to try to touch this code, but it shouldn't be that bad (famous last words :))
The problem with the feature outlined above is that syslog-ng doesn't know the notion of 'last' file. It can write to several files in parallel. Imagine a destination /var/log/messages/$PROGRAM, where each program has its own file. -- Bazsi PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
participants (2)
-
Balazs Scheidler
-
Jay Goldberg