Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2002
    Posts
    1,298

    Can raw logs be reset or re-zero?

    Is there any way to reset or re-zero the Raw Logs to
    assess the access to the site (linux/apache server). The client have been using them to see who has accessed the site following a mailing to corporations on a product they're releasing and would like to be able to 'reset' it periodically to make reviewing it a bit easier. Is this possible? Hoping for some input.

    Thanks
    John

  2. #2
    Join Date
    Jun 2001
    Location
    Earth
    Posts
    1,259
    It sounds as if you're talking about the Apache logs. If that's true, you can just "mv" (move) the existing file to a new name and they issue a "graceful" restart to Apache. It will close the renamed log and open a new one.

    Frank
    Umbra Hosting
    cPanel | Softaculous | CloudLinux | R1Soft | Ksplice
    Web Hosting, Reseller Hosting, VPS, Dedicated Servers, Colocation
    UmbraHosting.com

  3. #3
    Join Date
    Feb 2002
    Posts
    2,120
    or you could also do the 'bad way'

    echo "" > log_file_here

    )) But you lose log file content

  4. #4
    Join Date
    Jun 2001
    Location
    Earth
    Posts
    1,259
    Originally posted by apollo
    or you could also do the 'bad way'

    echo "" > log_file_here

    )) But you lose log file content
    And you may end up with a very large empty file

    Frank
    Umbra Hosting
    cPanel | Softaculous | CloudLinux | R1Soft | Ksplice
    Web Hosting, Reseller Hosting, VPS, Dedicated Servers, Colocation
    UmbraHosting.com

  5. #5
    Join Date
    May 2001
    Location
    California
    Posts
    801
    I would find a good logrotate scripts which I think RedHat has one already. You can set it to rotate log every night and only keep the logs for 7 days. That way the script will delete all logs that are older than 7 days. I think this is a better way than deleting content of these logs.

    You never know when you will need these old logs ..


    Cheers,
    Roy K.
    Pixie Internet Services - http://www.pixiehost.com
    Affordable, reliable hosting solution with Instant Activation

  6. #6
    Join Date
    Feb 2002
    Posts
    1,298
    Thanks alot for your suggestions . So it can be done. That's great.

    John

  7. #7
    Join Date
    Aug 2001
    Location
    Brea, CA
    Posts
    541
    Just a note:

    With some server daemons (or versions) when you physically move a file rather than copy and zero it (with echo > [file]) the file handle is lost, and until that daemon is restarted it will not continue logging.

    Depending on the code, this can be sometimes be fixed with a simple "touch filename".

    I'd recommend a good logrotate script as well, and just bypass the whole hassle of nuking the large logs.
    Jeff Standen, Software Architect, Cerb
    Cerb - web-based teamwork and workflow automation - https://cerb.ai/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •