Results 1 to 12 of 12
  1. #1
    Join Date
    Jan 2001
    Location
    Buffalo, NY, USA
    Posts
    252

    Question

    'Allo. Have a bit of a challenge with log files. I'd like to be able to have things set up so that at a regular interval, the server would take the current access and error log, compress it (gzip) and dump it into a \logs directory on my site, then reset the logs. I've seen a few hosts that offer this, but so far am having no luck figuring out how to do it on my current host. (Burst/US when asked said yes you may...new host currently being sought.) Basic specs are I believe a RH 6.2, with CPanel. I tried hunting around the server thru telnet, but every spot that -should- have logs in it only has empty files, and I can't locate the file that the cpanel wants to ftp to me.

    Since I've been informed that this particular server config dumps the logs every month to save space and I really prefer to do my own log analysis I'm kinda in a bind.

    Help, Hints greatly apreciated.

    Thanks!
    Bob Hubbard,
    SilverStar WebDesigns Inc

    silverstarsites.net

  2. #2
    Couldnt you do this with a simple cron Script?
    The Php Support Desk
    http://www.phpsupportdesk.com
    Custom programming - kunal @ e-phoria.com
    http://www.pingzine.com - Ping!Zine. the FREE, FRESH and EXCITING Web Hosting Magazine...

  3. #3
    Join Date
    Jan 2001
    Location
    Buffalo, NY, USA
    Posts
    252

    Question

    We could. 2 problems:

    1- No clue how to write the script. My guess would be something like "gzip source destination" but....

    2- No idea where the log files in question are as -every- spot I checked on the server had empty log files, and I couldn't find the file or directory that the CPANEL shows when I click on (download raw log file)

    I'm lost.
    Bob Hubbard,
    SilverStar WebDesigns Inc

    silverstarsites.net

  4. #4
    Join Date
    Dec 2000
    Location
    Leesburg, VA
    Posts
    3,209
    Find out from your provider where the log files are located, and I can give you a sample shell script that will do it for you .


  5. #5
    Join Date
    Jan 2001
    Location
    Buffalo, NY, USA
    Posts
    252

    Smile Thanks!

    Ok, we got the info on where the current logs are kept. Can you email the script? Tis greately apreciated!

    (also, is this for servers or domains? all of our current accts are resolds at the moment, but we are looking at going dedicated shortly.)

    Thanks!
    Bob Hubbard,
    SilverStar WebDesigns Inc

    silverstarsites.net

  6. #6
    Join Date
    Dec 2000
    Location
    Leesburg, VA
    Posts
    3,209
    Here's the link to the script:

    http://www.scriptsolutions.com/progr...eup/index.html

    All you need to do is create a cron job that does the backup as often as you want.

    You can read more about writing cron jobs here:

    http://www.unm.edu/cgi-bin/man-cgi?crontab

    Of course, since you are running on Linux, you can just put the script right in:

    /etc/cron.half-hourly
    /etc/cron.hourly
    /etc/cron.monthly
    /etc/cron.quarter-daily
    /etc/cron.quarter-hourly
    /etc/cron.weekly

    Hope this helps

  7. #7
    Join Date
    Jan 2001
    Location
    Buffalo, NY, USA
    Posts
    252

    Smile

    Thanks. I apreciate the info on Cron how-tos too, as I honestly have no clue on em, and would hate to start world war III cuz of a typo.

    Looks like that will do the trick.

    Again, thanks!
    Bob Hubbard,
    SilverStar WebDesigns Inc

    silverstarsites.net

  8. #8
    Join Date
    Dec 2000
    Location
    Leesburg, VA
    Posts
    3,209
    Great...glad it helped. And no worries, unless the RaQ starts asking "Would you like to play a game?" you are okay.

  9. #9
    Join Date
    Jan 2001
    Location
    Buffalo, NY, USA
    Posts
    252

    Cool

    Got the script installed. Had a few hiccups as it couldn't find the config file (which docs refer to as being part of the actual file), but a little cut n paste magic and I got it up and running great.

    Also got a little gzip cron running that shrinks the bugger to a managable size. Question now is, is there an easy way to set cron up to run on the last day of the month?

    Again Thanks!
    Bob Hubbard,
    SilverStar WebDesigns Inc

    silverstarsites.net

  10. #10
    Join Date
    Dec 2000
    Location
    Leesburg, VA
    Posts
    3,209
    Actually, the easiest way is to set it to run on the first day of the month .

  11. #11
    Join Date
    Jan 2001
    Location
    Buffalo, NY, USA
    Posts
    252

    Unhappy

    Problem is the server resets the logs then. So if I ran it then, I'd always be backing up clean logs, rather than full ones. right now, i've got it doing it daily, to a new file, with gzip squashing the file to a more manageable size, but I end up with alot of redundant data.

    I'm gonna go do a lil digging in the mean time, but I'm open to suggestions.

    thanks again.
    Bob Hubbard,
    SilverStar WebDesigns Inc

    silverstarsites.net

  12. #12
    Join Date
    Dec 2000
    Location
    Leesburg, VA
    Posts
    3,209
    The quick, kludgy way to do this would be to set a cron job to do what you want you and schedule it to run the 28th, 30th and 31st.

    A more elegant method would be to schedule the cron job to run every day. The cron job would run a perl script that checks the date, and if the date matches a preset date it performs an action, otherwise it doesn't do anything.

    Let me know if that helps.

Posting Permissions

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