INN commit: branches/2.5 (3 files)
INN Commit
rra at isc.org
Mon Mar 18 18:48:18 UTC 2013
Date: Monday, March 18, 2013 @ 11:48:18
Author: iulius
Revision: 9464
Rotate innfeed logs
Exploder and process channels are now properly reopened when "ctlinnd
flushlogs" is used, which is in particular the command invoked by
scanlogs to rotate log files.
It solves the issue that caused the patch to be reverted by commit
[9450].
Modified:
branches/2.5/doc/pod/news.pod
branches/2.5/innd/cc.c
branches/2.5/scripts/scanlogs.in
---------------------+
doc/pod/news.pod | 12 ++++++++++++
innd/cc.c | 14 +++++++++++++-
scripts/scanlogs.in | 24 +++++++++++++++++++++++-
3 files changed, 48 insertions(+), 2 deletions(-)
Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod 2013-03-18 18:47:27 UTC (rev 9463)
+++ doc/pod/news.pod 2013-03-18 18:48:18 UTC (rev 9464)
@@ -1,3 +1,15 @@
+=head1 Changes in 2.5.4
+
+=item *
+
+When using funnel feeds, B<innfeed> log files were open forever, which
+resulted in empty log files, once rotated by B<scanlogs>. Exploder and
+process channels are now reopened when C<ctlinnd flushlogs> is used,
+which is in particular the command invoked by B<scanlogs> to rotate
+log files.
+
+=back
+
=head1 Changes in 2.5.3
Please note that the HTML_STATUS compile-time option has been replaced
Modified: innd/cc.c
===================================================================
--- innd/cc.c 2013-03-18 18:47:27 UTC (rev 9463)
+++ innd/cc.c 2013-03-18 18:48:18 UTC (rev 9464)
@@ -629,11 +629,14 @@
/*
-** Flush the log files.
+** Flush the log files as well as exploder and process channels.
*/
static const char *
CCflushlogs(char *unused[])
{
+ SITE *sp;
+ CHANNEL *cp;
+ int i;
unused = unused; /* ARGSUSED */
if (Debug)
@@ -643,6 +646,15 @@
syslog(L_NOTICE, "%s flushlogs %s", LogName, CCcurrmode());
ReopenLog(Log);
ReopenLog(Errlog);
+ /* Flush exploder and process channels so that they take into account
+ * the new log files (for instance during log rotation). */
+ for (sp = Sites, i = nSites; --i >= 0; sp++) {
+ if (((cp = sp->Channel) != NULL)
+ && ((cp->Type == CTexploder) || (cp->Type == CTprocess))) {
+ SITEflush(sp, true);
+ syslog(L_NOTICE, "%s flush", sp->Name);
+ }
+ }
return NULL;
}
Modified: scripts/scanlogs.in
===================================================================
--- scripts/scanlogs.in 2013-03-18 18:47:27 UTC (rev 9463)
+++ scripts/scanlogs.in 2013-03-18 18:48:18 UTC (rev 9464)
@@ -22,12 +22,21 @@
## Where these programs, if used, write their logs.
## We also have to find innfeed's log file.
CONTROLBATCH=${MOST_LOGS}/controlbatch.log
+INNFEEDCONF=${PATHETC}/innfeed.conf
+if [ -f "${INNFEEDCONF}" ]; then
+ INNFEEDLOG=`${AWK} '{gsub(/:|#/, " & ")} {if ($1 == "log-file" && $2 == ":") print $3}' ${INNFEEDCONF}`
+fi
+INNFEED=
+for F in "${INNFEEDLOG}" ; do
+ test -f "${MOST_LOGS}/${F}" && INNFEED="${INNFEED} ${MOST_LOGS}/${F}"
+done
+test -z "${INNFEED}" && test -f "${MOST_LOGS}/innfeed.log" && INNFEED="${MOST_LOGS}/innfeed.log"
NNTPSEND=${MOST_LOGS}/nntpsend.log
PERLNOCEM=${MOST_LOGS}/perl-nocem.log
SENDIHAVE=${MOST_LOGS}/send-ihave.log
SENDNNTP=${MOST_LOGS}/send-nntp.log
SENDUUCP=${MOST_LOGS}/send-uucp.log
-LIVEFILES="${CONTROLBATCH} ${NNTPSEND} ${PERLNOCEM} ${SENDIHAVE} ${SENDNNTP} ${SENDUUCP}"
+LIVEFILES="${CONTROLBATCH} ${INNFEED} ${NNTPSEND} ${PERLNOCEM} ${SENDIHAVE} ${SENDNNTP} ${SENDUUCP}"
## Where news.daily places expire output, unless noexplog was used.
EXPLOG=${MOST_LOGS}/expire.log
@@ -102,6 +111,9 @@
ctlinnd -s logmode
PAUSED=false
ctlinnd -s pause "Flushing log and syslog files" 2>&1 && PAUSED=true
+
+ # First, flush log files to be sure everything has been recorded
+ # before rotating them.
OUTPUT=`ctlinnd flushlogs 2>&1`
if [ "$OUTPUT" != "Ok" -a "$OUTPUT" != "In debug mode" ]; then
echo "$OUTPUT"
@@ -148,6 +160,16 @@
## Tally control messages if we logged them.
test -n "${CONTROL_DATA}" && cat ${CONTROL_DATA} | ${TALLY_CONTROL}
+ # Flush again log files so that freshly rotated new log files
+ # are properly taken into account.
+ OUTPUT=`ctlinnd flushlogs 2>&1`
+ if [ "$OUTPUT" != "Ok" -a "$OUTPUT" != "In debug mode" ]; then
+ echo "$OUTPUT"
+ echo 'Cannot flush logs.'
+ rm -f ${LOCK}
+ exit 1
+ fi
+
${PAUSED} && ctlinnd -s go "Flushing log and syslog files" 2>&1
cd ${OLD}
More information about the inn-committers
mailing list