Retrieving Raw Access Logs

They have: 3 posts

Joined: Jan 2003

Hello,

Does anyone know how to automate the retrieval of raw access logs by setting up a cron job (or any other method)? My web host doesn't keep previous months' log files but rather resets the log file to the current month. I'd like to snag that log file on the last day of each month...

Thanks in advance for any help.

mjames's picture

They have: 2,064 posts

Joined: Dec 1999

It depends on what options your host offers. If they have CPanel with the Cronjobs page, you should be able to automate it from there. I recommend contacting your host about this.

Busy's picture

He has: 6,151 posts

Joined: May 2001

This is one that is offered by my web host, two files

ftpsettings.txt
--------------------------
OPEN ftp.yourdomain.com
rem first line needs to be changed to your server

[email protected]
rem set your login on the line above in the format shown
password
rem set your password on the line above

ASCII

LCD c:\logs
rem change the line above to desired local directory.

cd /var/log/httpd
rem the path to yoru log files

get access_log
get access_log.1
get access_log.2
get access_log.3
get access_log.4
rem ensim has 5, plesk etc only have one, change to suit

close
quit

rem Open task schedular and point it to ftp2.cmd set the auto run time to 2:12am CST this will grab the logs right after there switched.
rem remove all lines starting with "rem" from this file. Also make sure there is only one line inbetween each command.

----------------
ftp2.cmd
--------------------
ftp -s:ftpsettings.txt

They have: 19 posts

Joined: Jan 2003

if you're on unix:
type "crontab -e" to edit the cronjob

55 23 28-31 * * cp ./logfile ./logfile.bu

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.