Re: [logs] tbird rant: syslog.conf, tabs and spaces

From: Sweth Chandramouli (loganalysisat_private)
Date: Wed May 07 2003 - 06:46:48 PDT

  • Next message: Martin Schneider: "RE: [logs] IIS Message Meanings"

    On Tuesday, 06 May 2003 at 18:57:27 EDT,
       Tina Bird (Tina Bird <tbird@precision-guesswork.com>) wrote:
    > Why the *bleep* can't it be civilized and write a message to the damn
    > system log?  Or to the console? Or to its own special logfile?
    	NetBSD's version, at least, does complain to console, and
    then pretends that those spaces are in fact tabs, as do a fair number
    of other versions.  The FUD about spaces between selectors and actions
    still persists, however, to the point that on one of those systems
    that deals fine with spaces, the manpage claimed (at least as of one or
    two years ago) that it was essential to remember not to use spaces in
    the file.
    
    	For those who aren't on such a system, or who bounce
    between OSes too frequently to be bothered worrying whether today's
    OS has issues with spaces or not, here's a quickie that will ID errant
    spaces in a syslog.conf file:
    
    $ perl -ne '
       ($s) = /^([^#]\S+\s+)/ and
       $s =~ s/ /<SPACE>/g and
       do { $s =~ s/\t/<TAB>/g ; print "$.: $s\n"; };
    ' /etc/syslog.conf
    
    	(which returns things like:
    
    25: mark.debug;auth.err<SPACE><SPACE><SPACE>
    31: user.debug<SPACE>
    33: daemon.debug<TAB><SPACE>
    
    	).  In the same way that lots of systems have a vipw
    command to check for errors, I often like to write a wrapper for
    syslog.conf to at least check for spaces like this, if not doing a full
    syntax check, after each edit.  (The checking can also be done using
    sed or awk, so it's even possible to put some logic into your
    /etc/init.d/syslogd file (or equivalent) to check for the spaces and
    log errors if needed before ever starting syslogd. [1])
    
    	-- Sweth.
    
    [1] sed or awk being necessary since many people don't have perl
        installed on a FS that will be mounted when startup scripts are being
        run.
    
    -- 
    Sweth Chandramouli      Idiopathic Systems Consulting
    svcat_private      http://www.idiopathic.net/
    _______________________________________________
    LogAnalysis mailing list
    LogAnalysisat_private
    http://lists.shmoo.com/mailman/listinfo/loganalysis
    



    This archive was generated by hypermail 2b30 : Wed May 07 2003 - 10:13:26 PDT