-
'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!
-
Couldnt you do this with a simple cron Script?
-
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.
-
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 :).
-
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!
-
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
-
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. :beer:
Looks like that will do the trick.
Again, thanks!
-
Great...glad it helped. And no worries, unless the RaQ starts asking "Would you like to play a game?" you are okay.
-
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!
-
Actually, the easiest way is to set it to run on the first day of the month :).
-
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.
-
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.