Hi, logrotate currently breaks if a file is covered by more than two rules. We need this ability to hand-pick certain logfiles from a busy directory, and then apply a wildcard patern to the rest. I have attached a patch against 3.7.9 which covers this. The patch also adds a feature whereby the state file is cleaned of any entries for which the logfile does not exist during a given run. This is to handle the case where a directory contains many (in our case possibly hundreds of thousands - don't ask) of logfiles with per-process names, and you want them to be removed/archive or whatever but once they're gone, they're gone. The state file could end up massive if 'dead' entries were not removed. Last, there is a small bug which affects Cygwin, where any path-related config settings are rejected. Note that this is *not* the earlier, fixed bug in the same area. Cygwin's implementation of mbrtowc returns -2 if it is passed a 0-length string, and this is counted as a failure. I have added an additional test to handle this specific area, even though it's probably a Cygwin problem. Regards, Jim --
Jim Keir Technical Consultant Prologic Plc Redwood House, Berkhamsted,
Hertfordshire. HP4 2DH, UK Tel: +44 (0)1442 876277 Email: jk...@prologic.com Web: www.prologic.com The Business Solution
For Fashion &
Lifestyle |
107c107 < while( (len = mbrtowc(&pwc, chptr, strlen(chptr), NULL)) != 0 ) { --- > while( chptr[0] && (len = mbrtowc(&pwc, chptr, strlen(chptr), NULL)) != > 0 ) { 556c556 < #ifdef __hpux --- > #if defined(__hpux) || defined(__CYGWIN__) 587c587 < #ifndef __hpux --- > #if !(defined(__hpux) || defined(__CYGWIN__)) 698a699,706 > } else if (!strcmp(start, "duplicateok")) { > newlog->flags |= LOG_FLAG_DUPLICATEOK; > > *endtag = oldchar, start = endtag; > } else if (!strcmp(start, "noduplicateok")) { > newlog->flags &= ~LOG_FLAG_DUPLICATEOK; > > *endtag = oldchar, start = endtag; 1442,1452c1450,1471 < for (k = 0; k < log->numFiles; k++) { < if (!strcmp(log->files[k], < globResult.gl_pathv[i])) { < message(MESS_ERROR, < "%s:%d duplicate log entry for %s\n", < configFile, lineNum, < globResult.gl_pathv[i]); < logerror = 1; < goto duperror; < } < } --- > for (k = 0; k < log->numFiles; k++) { > if (!strcmp(log->files[k], > globResult.gl_pathv[i])) { > if (log->flags & > LOG_FLAG_DUPLICATEOK) { > message(MESS_VERBOSE, > "%s:%d > duplicate log entry for %s using pattern \"%s\"\n", > configFile, > lineNum, > > globResult.gl_pathv[i], > log->pattern); > /* Already registered, > but the original definition allows duplicates. > * Allow the program to > continue, using the original match. */ > goto dupcontinue; > } else { > message(MESS_ERROR, > "%s:%d > duplicate log entry for %s\n", > configFile, > lineNum, > > globResult.gl_pathv[i]); > logerror = 1; > goto duperror; > } > } > } 1457a1477 > dupcontinue: {}
20a21 > #define LOG_FLAG_DUPLICATEOK (1 << 11)
1420a1421,1425 > > if (p->sb.st_ctime == 0 && p->sb.st_ino == 0) { > continue; > } >