circular logging & control structure based destination
Hey Folks, Can syslog-ng do circular logging? If you are wondering what I mean by that, I'm referring to writing messages to a file, and when the destination reaches a limit, old messages are removed so the new ones can hang around for a bit. The limit could be file size, message date or time, or something else perhaps. For my needs, I would love to set a file size limit. Say 20megs per destination file. Also the idea of having the destination be chosen through a control structure like an if/then statement is very appealing. The idea being, if destination A is available (network connection, file w/ X amount of disk space, etc) then log there, otherwise check destination B, or the next, and so on... Having the destination be able to change dynamically would be ideal. Unfortunately I don't have the c knowledge to make that happen, so the best thing I've come up with is through the use of a few different syslog-ng.conf files and some perl to watch network connections. Kind of messy... Thoughts, ideas, rude comments? Finding a way to do the first one, and better way for the second would be great! Thanks... Shawn
Dan Bernstein's multilog sort of has what you need for file size limits. All his stuff just uses pipes, so you can stick it in a syslog-ng config easily. It's not really circular, as when the file hits it's limit, it gets rotated. The current file is always called the same thing, so it should suit. This software is at http://cr.yp.to/daemontools.html Glen ----- Original Message ----- From: "Shawn Davenport" <shawn.davenport@currenex.com> To: <syslog-ng@lists.balabit.hu> Sent: Friday, April 20, 2001 3:09 PM Subject: [syslog-ng]circular logging & control structure based destination
Hey Folks, Can syslog-ng do circular logging? If you are wondering what I mean by that, I'm referring to writing messages to a file, and when the destination reaches a limit, old messages are removed so the new ones can hang around for a bit. The limit could be file size, message date or time, or something else perhaps. For my needs, I would love to set a file size limit. Say 20megs per destination file.
"SD" == Shawn Davenport <shawn.davenport@currenex.com> writes:
SD> Unfortunately I don't have the c knowledge to make that happen, so SD> the best thing I've come up with is through the use of a few SD> different syslog-ng.conf files and some perl to watch network SD> connections. Kind of messy... You can send messages to a program which receives the messages on stdin using the pipe() destination. Simply add up the length of each line you receive and rotate the log filenames when you hit your limit. Perl would of course be ideal for this. Also, remember that programs started by pipe() are only started once, and should have a while(<>) loop or equivalient. -- ___ . . . . . + . . o _|___|_ + . + . + . . Per Olofsson, konstnär o-o . . . o + MagerValp@cling.gu.se - + + . http://www.cling.gu.se/~cl3polof/
participants (3)
-
Glen Williams
-
MagerValp
-
Shawn Davenport