Re: [PATCH] newsyslog - don't compress first log file

2007-08-12 Thread Dirk GOUDERS
> Ah -- well, then: by all means.  I'm even more willing to test other
> folks' work than I am to hack away at code. :-}
> 
> And since I had tested my own Perl script, I think I should be able to
> help out with this.  :-)
> 
> And "after Sunday" is not a problem at all:  thank you!

I tested the changes that allow to specify that n logfiles should not
be compressed and attach a patch for version 1.107 of newsyslog.c to
this mail.  The changes do not handle cases of changes to the
configfile while compressed and uncompressed logfiles already exist.

Again, here is a configfile example:

# logfilename  [owner:group]mode count size when  flags [/pid_file] 
[sig_num]
/var/log/example.log644  89100  * J39


Then, I have a question concerning the code:

(void) snprintf(file1, sizeof(file1), "%s.%d", ent->log,
ent->numlogs);
(void) snprintf(zfile1, sizeof(zfile1), "%s%s", file1,
COMPRESS_POSTFIX);
snprintf(jfile1, sizeof(jfile1), "%s%s", file1,
BZCOMPRESS_POSTFIX);

Is there a reason why the third call of snprintf is not casted to
(void)?

Dirk

--- newsyslog.c.origSun Aug 12 14:13:38 2007
+++ newsyslog.c Sun Aug 12 14:36:51 2007
@@ -127,6 +127,8 @@
struct ptime_data *trim_at; /* Specific time to do trimming */
unsigned int permissions;   /* File permissions on the log */
int flags;  /* CE_COMPACT, CE_BZCOMPACT, CE_BINARY */
+   int nuncompact; /* number of rotations that should not
+* be compressed; -1 turns this off */
int sig;/* Signal to send */
int def_cfg;/* Using the  rule for this file */
struct conf_entry *next;/* Linked list pointer */
@@ -1187,6 +1189,11 @@
}
 
for (; q && *q && !isspacech(*q); q++) {
+   if (isdigit(*q)) {
+   working->nuncompact = strtol(q, NULL, 10);
+   while(isdigit(*(q+1))) q++;
+   continue;
+   }
switch (tolowerch(*q)) {
case 'b':
working->flags |= CE_BINARY;
@@ -1456,6 +1463,12 @@
(void)rename(zfile1, zfile2);
}
change_attrs(zfile2, ent);
+   if ((flags & (CE_COMPACT | CE_BZCOMPACT)) &&
+   (ent->nuncompact != -1) &&
+   (numlogs_c == ent->nuncompact)) {
+   free_or_keep = KEEP_ENT;
+   save_zipwork(ent, NULL, ent->fsize, file2);
+   }
}
 
if (ent->numlogs > 0) {
@@ -1494,7 +1507,8 @@
swork = NULL;
if (ent->pid_file != NULL)
swork = save_sigwork(ent);
-   if (ent->numlogs > 0 && (flags & (CE_COMPACT | CE_BZCOMPACT))) {
+   if (ent->numlogs > 0 && (flags & (CE_COMPACT | CE_BZCOMPACT))
+   && ent->nuncompact == -1) {
/*
 * The zipwork_entry will include a pointer to this
 * conf_entry, so the conf_entry should not be freed.
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Re: [PATCH] newsyslog - don't compress first log file

2007-08-12 Thread David Wolfskill
On Sun, Aug 12, 2007 at 02:24:20PM +0200, Ulrich Spoerlein wrote:
> ...
> > We have a requirement to retain some number of logfiles, but only
> > compress those older than the Nth generation.
> > 
> > Thus, we might retain 90 "rotated" generations of the log file, of which
> > the oldest 50 are compressed, while the newest 40 are not.
> 
> Sorry, to be so blunt, but I think this .N suffix is a stupid approach
> for archival purposes. You never know which time span is included in the
> file foo.17.gz.

First, no problem with being blunt; it facilitates communication.  :-)

That said, we're not keeping the files for particularly long, so
"archival" isn't an issue for us.

It's merely that the files are extremely compressible (compressed size
is about 12% the original), but for various reasons outside the control
of those of us who run the machines, we need to keep some number of the
most recent of them uncompressed.

> I'd rather see an extension for newsyslog which would rotate foo to
> foo.2007-08-12.gz, iff rotation is done every day at midnight.
> 
> That way, you get a 'stable' name, which makes it easier to find the
> logfile for 1999-12-31 or 2000-01-01 some years from now.

And on the other hand, to find the log for 3 days ago, you need to have
a better idea of the current date than I generally do unless I check
(either my watch or `date`).  :-}  So there are trade-offs.  :-}

Then again, I'm rather in the habit of using "ls -ltr " when I'm
interested in the more recent of a set of files.

> Right now, I have to use syslog-ng for that purpose.

Well, I certainly wouldn't object to the existence of such a feature,
whether or not I'd use it myself.  :-)

Peace,
david

-- 
David H. Wolfskill  [EMAIL PROTECTED]
Anything and everything is a (potential) cat toy.

See http://www.catwhisker.org/~david/publickey.gpg for my public key.


pgp8UmnY3GjP0.pgp
Description: PGP signature


Re: [PATCH] newsyslog - don't compress first log file

2007-08-12 Thread Ulrich Spoerlein
On Fri, 10.08.2007 at 09:13:18 -0700, David Wolfskill wrote:
> On Fri, Aug 10, 2007 at 02:19:55PM +0300, Artis Caune wrote:
> > How about aditional flag ("X") to newsyslog, which don't compress first 
> > log file?
> >...
> 
> Interesting idea, but it still falls short of something we recently
> needed to do at work:
> 
> We have a requirement to retain some number of logfiles, but only
> compress those older than the Nth generation.
> 
> Thus, we might retain 90 "rotated" generations of the log file, of which
> the oldest 50 are compressed, while the newest 40 are not.

Sorry, to be so blunt, but I think this .N suffix is a stupid approach
for archival purposes. You never know which time span is included in the
file foo.17.gz.

I'd rather see an extension for newsyslog which would rotate foo to
foo.2007-08-12.gz, iff rotation is done every day at midnight.

That way, you get a 'stable' name, which makes it easier to find the
logfile for 1999-12-31 or 2000-01-01 some years from now.

Right now, I have to use syslog-ng for that purpose.

Cheers,
Ulrich Spoerlein
-- 
It is better to remain silent and be thought a fool,
than to speak, and remove all doubt.
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: [PATCH] newsyslog - archive logs with a timestamp

2007-08-12 Thread Dan Rue
On Sun, Aug 12, 2007 at 02:24:20PM +0200, Ulrich Spoerlein wrote:
> I'd rather see an extension for newsyslog which would rotate foo to
> foo.2007-08-12.gz, iff rotation is done every day at midnight.

Sorry to hijack the thread, but this is something that I've been looking
for for a long time as well.

There's even a patch that's been sitting in purgatory since 2001.

http://www.freebsd.org/cgi/query-pr.cgi?pr=30654&cat=

Dan
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: finished? porting ZyDAS zb1211/zb1211b driver for FreeBSD

2007-08-12 Thread Weongyo Jeong
Ok.  I would try to port the zyd driver to the HPS USB stack when I have
spare time.  When some progress is made, I will let you know about it.

Best Regards,
Weongyo Jeong

On Fri, Aug 10, 2007 at 12:10:20PM +0200, Hans Petter Selasky wrote:
> On Thursday 09 August 2007, M. Warner Losh wrote:
> > In message: <[EMAIL PROTECTED]>
> >
> > Hans Petter Selasky <[EMAIL PROTECTED]> writes:
> > : On Sunday 05 August 2007, Weongyo Jeong wrote:
> > : > Hello,
> > : >
> > : > I just finished to port zyd(4) from NetBSD for FreeBSD and it works
> > : > well in my environment without any panic ;-) (In zb1211b, RF AL2230,
> > : > open auth, 54M).  But It's not perfect and not be tested on another RF
> > : > controllers and not on zb1211.  IMO, it would work too.
> > : >
> > : > A patch which is for CURRENT is available at
> > : > http://weongyo.org/patches/freebsd/if_zyd-CURRENT-20070805.diff
> > : >
> > : > Comments, questions and feedbacks always welcome.
> > : >
> > : > PS. special thanks to Pyun YongHyeon.
> > :
> > : Hi,
> > :
> > : Is it possible that you could spend some time porting your ZYD driver to
> > : the HPS USB stack aswell ?
> >
> > Isn't zyd already in the hps stack?
> >
> > Warner
> 
> Yes it is, but the version I ported was not functional at that time.
> 
> --HPS
> ___
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "[EMAIL PROTECTED]"
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"