Anyway - here's my problem: At the end of the month my host starts a new log file by overwriting the existing one which causes all the prior month's data to be gone. I usually remember to download them before this happens but there has to be a better way!
QUESTION:
Is there a simple script out there I can use to rename (or copy to another subdirectory) my log file just before midnight at month's end?
Anyone else know another creative way to solve this problem?
Thanks!
John
Should not affect any online stats as long as you configure them to create or keep history.
If you dont have an apache server I am sure there is a windows equivalent script.
Hope this helps.
Or, I can write you a shell or perl script to do it for you.Sticky me for more info.
amoore:
I cannot find any reference to "cron" in our help area on our host. I don't think we can run cron applications. We do not have directories "/usr/sbin or /usr/bin or /usr/local/bin"
Will the program 'logrotate' work from our cgi-bin directory? Our Apache server is configured to run PHP, Perl, etc.
Thanks for your leads.
John
PS - I stumbled across O'Reilley ONLamp.com. Seems like they may have some related info to the program Logrotate. I'll sticky you (amoore) if I can't solve it myself. Thanks!
When you ftp in do you only see the directories where your web files exist or do you see the configuration directories as well.
Unless you have a dedicated or semi dedicated virtual server the hosting company may well have restricted you to running their or other scripts in the cgi bin in which case you will have to speak to your support people and ask them if what you want can be implemented.
Its not hard, if they cannot do this for you I would consider looking around for the future. You want more information available to you, in case you need it, not less.
bin, cert, cgi-bin, conf, httpdocs, httpsdocs, logs, pd, and web_users
I have just put a request into our helpdesk to ask about running cron jobs (I can't find anything about "cron" in the help files). I also asked them about Logrotate to see if they are familiar with it and asked them to suggest alternatives if it won't run on their servers.
The Control Panel says "Virtual host access for domain www.xxx.com" and "Virtual Host Type: IP-Based" and we have a static IP address.
John
On my server logrorate was already installed and runs each day, (possibly by a tech admin's cron tab) all I have to do is configure what log files I want logrorate to run on, how often to rotate how many copies to keep and to whom I want the final rotated file to be emailed to.
BTW you may also want to look into initially configuring the log files you want in the virtual host statement for your site.
Hope this helps, someone with a clue will doubtless be along shortly :-)
You can run Cron jobs at our servers - just place cron-pretender script into one of Your FTP directories and submit appropriate helpdesk request, e.g. "add cronjob /cgi-bin/logreader.pl, should be initiated weekly".
Can anyone here point me to a simple script of some sort so I can begin to learn how to do this? I have seached here and at Google and cannot find a script file that will move, copy, email, or zip my log files so they do not get overwritten every month. Any help would be greatly appreciated!
Thanks,
John
If I needed to solve this myself I would probably first:
- search my hosting companies online help files,
- search the internet via google
- including search of apache's website
- probably also search this site
- bug my tech support until they told me what I needed to know
I am sure you are aware that many tech support peoples responses are not always designed to help you solve the problem, often they just seem to feed you a little tit bit of information in the hope that you might go away or solve it yourself :-) how much assistance is there in your server contract, do be sure you get your moneys worth and don't get fobbed off.
Hope this helps but to be more specific I would have to do it for you and I am too busy right now sorry mate :-)