rotating logs and open handle (webstats) - Unix

This is a discussion on rotating logs and open handle (webstats) - Unix ; Hi I did use the tail command in a small script to rename access_log in acces_log.1 and keep the last lines of access_log.1 to create a new access_log. What happen now is that apache has an open handle to former ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: rotating logs and open handle (webstats)

  1. rotating logs and open handle (webstats)

    Hi

    I did use the tail command in a small script to rename access_log in
    acces_log.1 and keep the last lines of access_log.1 to create a new
    access_log.
    What happen now is that apache has an open handle to former access_log
    and it will continue to output requests (in access_log.1 this time)
    instead of the newly created access_log unless I restart the apache
    server. Any way to do this with a more elegant method?


  2. Re: rotating logs and open handle (webstats)

    In comp.unix.admin jean-francois :
    > Hi


    > I did use the tail command in a small script to rename access_log in
    > acces_log.1 and keep the last lines of access_log.1 to create a new
    > access_log.
    > What happen now is that apache has an open handle to former access_log
    > and it will continue to output requests (in access_log.1 this time)
    > instead of the newly created access_log unless I restart the apache
    > server. Any way to do this with a more elegant method?


    Yep.

    man rotatelogs

    ROTATELOGS(8) rotatelogs ROTATELOGS(8)

    NAME
    rotatelogs - Piped logging program to rotate Apache logs




    --
    Michael Heiming (X-PGP-Sig > GPG-Key ID: EDD27B94)
    mail: echo zvpunry@urvzvat.qr | perl -pe 'y/a-z/n-za-m/'
    #bofh excuse 102: Power company testing new voltage spike
    (creation) equipment

  3. Re: rotating logs and open handle (webstats)

    Michael Heiming wrote:
    > In comp.unix.admin jean-francois :
    >
    >>Hi

    >
    >
    >> I did use the tail command in a small script to rename access_log in
    >>acces_log.1 and keep the last lines of access_log.1 to create a new
    >>access_log.
    >>What happen now is that apache has an open handle to former access_log
    >>and it will continue to output requests (in access_log.1 this time)
    >>instead of the newly created access_log unless I restart the apache
    >>server. Any way to do this with a more elegant method?


    cp access_log access_log.1
    > access_log


    JohnK

    --
    ABSURDITY, n.
    A statement or belief manifestly inconsistent with one's own opinion.
    Ambrose Bierce, The Devil's Dictionary.

  4. Re: rotating logs and open handle (webstats)

    In comp.unix.admin JohnK :
    > Michael Heiming wrote:
    >> In comp.unix.admin jean-francois :
    >>
    >>>Hi

    >>
    >>
    >>> I did use the tail command in a small script to rename access_log in
    >>>acces_log.1 and keep the last lines of access_log.1 to create a new
    >>>access_log.
    >>>What happen now is that apache has an open handle to former access_log
    >>>and it will continue to output requests (in access_log.1 this time)
    >>>instead of the newly created access_log unless I restart the apache
    >>>server. Any way to do this with a more elegant method?


    > cp access_log access_log.1
    > > access_log


    gzip -9 access_log.1 # if available

    You gave to admit, *rotatelogs* which comes with apache has
    several advantages about doing it manually.

    BTW
    You might like to check how to go about quoting.

    --
    Michael Heiming (X-PGP-Sig > GPG-Key ID: EDD27B94)
    mail: echo zvpunry@urvzvat.qr | perl -pe 'y/a-z/n-za-m/'
    #bofh excuse 393: Interference from the Van Allen Belt.

+ Reply to Thread