ctlinnd flushlogs shouldn't rename logfiles

Matus "fantomas" Uhlar uhlar at fantomas.sk
Tue Jul 27 11:54:41 UTC 1999


Hello,

I am using my own way of rotating log files...
files are rotated every day before midnight and they are reopened at midnight.

The problem is, command "flushlogs" to innd causes files not just reopen but
rename them to "*.old". And that sux.

Renaming of logfiles can be easyly done by script which will send flushlogs
command etc. I don't need innd to rename logfiles. I have _much_ better way
of doing it. So I made little patch to innd.c not to do it.

*** innd.c.orig Sat Sep  5 17:04:28 1998
--- innd.c      Tue Jul 27 13:03:13 1999
***************
*** 365,373 ****
        Buffer = ErrlogBuffer;
      }
  
-     FileGlue(buff, Name, '.', "old");
-     if (rename(Name, buff) < 0)
-       syslog(L_ERROR, "%s cant rename %s to %s %m", LogName, Name, buff);
      mask = umask(033);
      if (freopen(Name, "a", F) != F) {
        syslog(L_FATAL, "%s cant freopen %s %m", LogName, Name);
--- 365,370 ----

And also I'd like to open discussion and see your comments on stuff like
this. I want news.daily just scan logs and process them, not to move
anything like that.

Also, they are no more in the OLD subdirectory;
and also as long as I use external log rotating, scanlogs really should NOT
touch them in this way it does; here's the patch


--- /home/news/inn-2.2/site/scanlogs    Mon Jun 21 18:11:16 1999
+++ scanlogs    Tue Jul 27 13:42:34 1999
@@ -9,8 +9,6 @@
 ##     sh -c 'egrep "`ls /etc`" /dev/null'
 ##  then get a better egrep, like the FSF one.
 
-##  Directory where old log files are kept.
-OLD=${MOST_LOGS}/OLD
 ##  If you want to archive the active file, enable this line.
 ACTIVEFILE=${ACTIVE}
 ##  Number of lines of error in each category to report.
@@ -71,6 +69,13 @@
     esac
 done
 
+if $ROTATE; then
+       ##  Directory where old log files are kept.
+       OLD=${MOST_LOGS}/OLD
+else
+       OLD=${MOST_LOGS}
+fi
+
 ##  Make sure every log exists.
 for F in ${LOGS} ; do
     test ! -f ${F} && touch ${F}
@@ -187,18 +192,6 @@
        ${LOG_COMPRESS} <${MOST_LOGS}/send-uucp.log >${OLD}/send-uucp.1${Z}
        cat /dev/null >${MOST_LOGS}/send-uucp.log
     fi
-else
-    ##  Don't use the real OLD directory, instead use TMPDIR
-    OLD=${TMPDIR}
-
-    ##  Make a snapshot of what we need for below.
-    ctlinnd -s pause "Snapshot log and syslog files" 2>&1
-    for F in ${SYSLOG_CRIT} ${ERRLOG} ${EXPLOG} ${LOG} ${SYSLOG_NOTICE} ;
do
-       BASE=`basename ${F}`
-       rm -f ${OLD}/${BASE}.0
-       cp ${F} ${OLD}/${BASE}.0
-    done
-    ctlinnd -s go "Snapshot log and syslog files" 2>&1
 fi
 
 ##
@@ -214,7 +207,9 @@
     echo ---------
     echo ''
 fi
-rm -f ${OLD_SYSLOG}
+if $DOROTATE; then
+       rm -f ${OLD_SYSLOG}
+fi
 
 ##  Display error log.
 BASE=`basename ${ERRLOG}`
@@ -225,7 +220,9 @@
     echo ---------
     echo ''
 fi
-rm -f ${OLD_ERRLOG}
+if $DOROTATE; then
+       rm -f ${OLD_ERRLOG}
+fi
 
 ##  Scan for various problems in articles we were offered or sent...
 BASE=`basename ${LOG}`
@@ -239,7 +236,9 @@
     echo ---------
     echo ''
 fi
-rm -f ${OLD_LOG} ${OLD_SYSLOG}
+if $DOROTATE; then
+       rm -f ${OLD_LOG} ${OLD_SYSLOG}
+fi
 
 ##  Compress and rotate the logs.
 if ${ROTATE} ; then

-- 
 Matus "fantomas" Uhlar, sysadmin at Telenor Internet Kosice, Slovakia
 BIC coord for *.sk; admin of netlab.irc.sk; co-admin of irc.felk.cvut.cz
 Boost your system's speed by 500% - DEL C:\WINDOWS\*.*


More information about the inn-workers mailing list