RE: Force newsyslog to rotate from custon script

From: JJB (Barbish3_at_adelphia.net)
Date: 05/12/04

  • Next message: Jason Dusek: "Setting Up IMAP"
    To: "Lowell Gilbert" <freebsd-questions-local@be-well.ilk.org>
    Date: Wed, 12 May 2004 09:27:02 -0400
    
    

    Thanks for your reply

    Both of your suggestions are good but have the same problem.

    When the newsyslog command is run the rotate space trigger in
    newsyslog.conf may or may not be met.
    I need an return code or exit code from the newsyslog command to
    check to tell if trigger was met and log really rotated.
    Does newsyslog issue such codes and how would I code an csh script
    to check for it?

    Trying to for see an DOS attack targeted at consuming all the log
    disk space in /var

    -----Original Message-----
    From: lowell@be-well.ilk.org [mailto:lowell@be-well.ilk.org]On
    Behalf Of Lowell Gilbert
    Sent: Wednesday, May 12, 2004 8:54 AM
    To: Barbish3@adelphia.net
    Cc: freebsd-questions@FreeBSD. ORG
    Subject: Re: Force newsyslog to rotate from custon script

    "JJB" <Barbish3@adelphia.net> writes:

    > Problem description: My ipfilter log is rotated using
    > newsyslog.conf. The file is rotated on file size option. I have
    > custom script that reads the log and builds email containing list
    of
    > abusive source IP address. This custom script is included in the
    > daily management report process. Problem is that on days that
    there
    > is a lot of blocked traffic the log may rotate multiple times and
    my
    > daily management report script only runs against the current
    active
    > log.
    >
    > Is their some way to keep the log defined in newsyslog.conf
    without
    > any rotate option and add something to my custom script to tell
    > newsyslog to rotate the log after the script has processed the
    > current active log file?

    I would recommend a slightly different approach. Either of a couple
    of different approaches, in fact...

    One way to do this would be to use a separate config file for
    newsyslog(8) rather than /etc/newsyslog.conf. Then you run
    newsyslog
    and use the -f option to have it use your special-purpose
    configuration just for rotating this ipfilter log.

    The other way would be to do the rotation directly, in your script
    which processes the file. It should only take three or four
    commands
    in the script. That would let you more or less eliminate any race
    conditions that might leave data out of your logs.

    _______________________________________________
    freebsd-questions@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-questions
    To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"


  • Next message: Jason Dusek: "Setting Up IMAP"

    Relevant Pages

    • RE: perl pause or wait
      ... Newsyslog does mv command to rename log.2 to log 3, ... working routine to add to my script to do that. ... Subject: perl pause or wait ... >I have perl script that issues the newsyslog command followed by 3 ...
      (freebsd-questions)
    • Re: Force newsyslog to rotate from custon script
      ... >> custom script that reads the log and builds email containing list ... This custom script is included in the ... >> any rotate option and add something to my custom script to tell ... >> newsyslog to rotate the log after the script has processed the ...
      (freebsd-questions)
    • Modernizing script that rotates images with links
      ... I'm trying to update a script I wrote that rotates images of book ... // define the images and rotate them ... thisAd = Math.floor* adImages.length)); ... What's the correct way of accessing the elements in my new array? ...
      (comp.lang.javascript)
    • Re: Modernizing script that rotates images with links
      ... I'm trying to update a script I wrote that rotates images of book ... // define the images and rotate them ... thisAd = Math.floor* adImages.length)); ... var rotate = { ...
      (comp.lang.javascript)
    • Rotate object in superengine for ruby
      ... In this virtualizer I need rotate ... ifthen diry = -1.0 end ... ifthen dirz = -1.0 end ... And this script has no errors but do nothing:( ...
      (comp.lang.ruby)