From eb35c38579da75061822524c7a7eafc72b2d0e7e Mon Sep 17 00:00:00 2001 From: Edward Rudd Date: Thu, 30 Oct 2008 23:10:36 +0000 Subject: make sure marker lines is written on filechange for badlines log --- utility/config.h | 1 + utility/logparse.c | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'utility') diff --git a/utility/config.h b/utility/config.h index c627662..ebedec3 100644 --- a/utility/config.h +++ b/utility/config.h @@ -30,6 +30,7 @@ struct config_t { apr_pool_t *errorlog_p; const char *badlinefile; + const char *badlastfile; apr_file_t *badline_fp; int badline_count; int badlinemax; diff --git a/utility/logparse.c b/utility/logparse.c index ec587a8..d172f27 100644 --- a/utility/logparse.c +++ b/utility/logparse.c @@ -228,7 +228,10 @@ apr_status_t parser_logbadline(config_t *cfg, const char *filename, logging_log(cfg, LOGLEVEL_NOISE, "Error opening badline file %s\n", cfg->badlinefile); cfg->badlinefile = NULL; - } else { + } + } + if (!rv) { + if (filename != cfg->badlastfile){ char date[APR_RFC822_DATE_LEN]; vec[0].iov_base = "Starting BadLines for \""; vec[0].iov_len = sizeof("Starting BadLines for \"")-1; @@ -242,9 +245,9 @@ apr_status_t parser_logbadline(config_t *cfg, const char *filename, vec[4].iov_base = "\n"; vec[4].iov_len = 1; apr_file_writev(cfg->badline_fp, vec,5, &len); + cfg->badlastfile = filename; } - } - if (!rv) { + if ((++cfg->badline_count) > cfg->badlinemax) { logging_log(cfg, LOGLEVEL_NOISE, "Found more than %d bad lines (found %d)", -- cgit