This is a discussion on FTPing logs from Apache 2.2 Win within the Apache Web Server forums, part of the Web Server and Related Forums category; I'm trying to retrieve my Apache logs using FileZilla but Apache seems to have done something to lock the ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I'm trying to retrieve my Apache logs using FileZilla but Apache seems
to have done something to lock the files preventing reading. If I stop Apache FileZilla retrieves them fine. The strange thing is that I can read them locally with notepad fine. Does anyone know of a solution? -- -Mike -- Posted via a free Usenet account from http://www.teranews.com |
|
|||
|
shimmyshack wrote:
> On Apr 21, 12:20 am, "Mike Warren" <miwa-not-this-...@or-this- > csas.net.au> wrote: > > I'm trying to retrieve my Apache logs using FileZilla but Apache > > seems to have done something to lock the files preventing reading. > yeah apache locks them, notepad ignores this, better programs dont. > You need to copy the logs somewhere, and filezilla them instead. Do > this using a server side script, which you can execute on demand, or a > cron, and you're done. I'm very new to this stuff and have no idea how to create a server side script and have not heard of cron, but I now have something to google on. Thanks. -- -Mike -- Posted via a free Usenet account from http://www.teranews.com |
|
|||
|
On Apr 21, 12:20 am, "Mike Warren" <miwa-not-this-...@or-this-
csas.net.au> wrote: > I'm trying to retrieve my Apache logs using FileZilla but Apache seems > to have done something to lock the files preventing reading. > > If I stop Apache FileZilla retrieves them fine. > > The strange thing is that I can read them locally with notepad fine. > > Does anyone know of a solution? > > -- > -Mike > > -- > Posted via a free Usenet account fromhttp://www.teranews.com yeah apache locks them, notepad ignores this, better programs dont. You need to copy the logs somewhere, and filezilla them instead. Do this using a server side script, which you can execute on demand, or a cron, and you're done. |
|
|||
|
On Apr 21, 1:01 am, "Mike Warren" <miwa-not-this-...@or-this-
csas.net.au> wrote: > shimmyshack wrote: > > On Apr 21, 12:20 am, "Mike Warren" <miwa-not-this-...@or-this- > > csas.net.au> wrote: > > > I'm trying to retrieve my Apache logs using FileZilla but Apache > > > seems to have done something to lock the files preventing reading. > > yeah apache locks them, notepad ignores this, better programs dont. > > You need to copy the logs somewhere, and filezilla them instead. Do > > this using a server side script, which you can execute on demand, or a > > cron, and you're done. > > I'm very new to this stuff and have no idea how to create a server side > script and have not heard of cron, but I now have something to google > on. > > Thanks. > > -- > -Mike > > -- > Posted via a free Usenet account fromhttp://www.teranews.com as davide says if you dont ned a giant log, you could rotate them, which creates many, this frees up the ones from previous days to be ftp'd by server side script, I simply meant that if you have php installed you can run a script like this one from the "copy" page in the manual. The you can FTP the new ones. copylogs.php <?php $file = 'c:/location/of/access.log'; $newfile = 'c:location/of/new.access.log'; if (!copy($file, $newfile)) { echo "failed to copy $file...\n"; } ?> if you dont have php installed, then there are other options, I mentioned cron, or cronw (from sourceforge) http://cronw.sourceforge.net/ which you can install on windows after you have installed perl. This is a small process that runs as a service in windows, you can add a cron job to the crontab.txt that will copy the old log overwriting the new one every specified period of time form one minute, one month... it might be a good workaround for you. If you are doing this because you want to get realtime acces to your logs you could tail the file, pick up a copy of unix tools for windows, which you can add to your path. http://unxutils.sourceforge.net/ then you can use something like <?php echo '<pre>'; exec( 'tail -n 100 "c:/location/access.log"' ); echo '</pre>'; ?> to get the last 100 rows. tail -n 100 "c:/location/access.log" > last100.log would create a file you could use. |
|
|||
|
Davide Bianchi wrote:
> On 2007-04-20, Mike Warren <miwa-not-this-bit@or-this-csas.net.au> > wrote: > > I'm trying to retrieve my Apache logs using FileZilla but Apache > > seems to have done something to lock the files preventing reading. > > Probably because he is writing in them > > > Does anyone know of a solution? > > Use a 'logrotate' system to write to a different log every now and > then so you can get the old ones. Thanks for your input, Davide. -- -Mike -- Posted via a free Usenet account from http://www.teranews.com |
|
|||
|
shimmyshack wrote:
> by server side script, I simply meant that if you have php installed > you can run a script like this one from the "copy" page in the manual. > The you can FTP the new ones. > copylogs.php > <?php > $file = 'c:/location/of/access.log'; > $newfile = 'c:location/of/new.access.log'; > > if (!copy($file, $newfile)) { > echo "failed to copy $file...\n"; > } > ?> Ok, that makes sense but I don't understand what triggers the script to run. > If you are doing this because you want to get realtime acces to your > logs you could tail the file, I set up a web server so I can learn about it. I found a freeware log analyser but was having trouble getting the logs to it. There may be a better way that I'm not aware of. For instance, I also found AWStats which may be better for me to use. I have also just discovered XAMPP. Perhaps a package like this would be better as a learning tool. I find I learn better by looking at examples. -- -Mike -- Posted via a free Usenet account from http://www.teranews.com |
|
|||
|
On Apr 23, 12:40 am, "Mike Warren" <miwa-not-this-...@or-this-
csas.net.au> wrote: > shimmyshack wrote: > > by server side script, I simply meant that if you have php installed > > you can run a script like this one from the "copy" page in the manual. > > The you can FTP the new ones. > > copylogs.php > > <?php > > $file = 'c:/location/of/access.log'; > > $newfile = 'c:location/of/new.access.log'; > > > if (!copy($file, $newfile)) { > > echo "failed to copy $file...\n"; > > } > > ?> > > Ok, that makes sense but I don't understand what triggers the script to > run. > > > If you are doing this because you want to get realtime acces to your > > logs you could tail the file, > > I set up a web server so I can learn about it. I found a freeware log > analyser but was having trouble getting the logs to it. There may be a > better way that I'm not aware of. For instance, I also found AWStats > which may be better for me to use. > > I have also just discovered XAMPP. Perhaps a package like this would be > better as a learning tool. I find I learn better by looking at examples. > > -- > -Mike > > -- > Posted via a free Usenet account fromhttp://www.teranews.com awstats is nice. the script is triggered by visiting it in a browser of by using cron. in my crontab its this (all on one line) (happens every day at 8 mins past 3 in the morning) 8 3 * * 0-6 wget --delete-after "http://server.com/backups/7z.php? domain=www.blah.info&logging=file" the script 7z.php is a small script that uses a call to 7zip to update a compressed backup of the domain and various things about the domain. In your case the script would just copy the log file, or FTP it to another location. you dont even need to use php for that kind of thing: 1 14 * * 0 copy "path/to/logs/access.log" "/new/path/to/logs/ access.log" (happens at 1 mins past 2 every sunday afternoon) both scripts can be executed on the command line, wget is used as a "browser" to make the request to the server script which does the hard work. I script in php alot so writing backup scripts in php is an easy thing, they dont have to run on the server though, you can use the activescripting dll, and write scripts that can be doubled clicked on or set off by scheduled tasks - although i think cronw is way better than the i nbuilt scheduled tasks. The tools I use for automated stuff like this are unix tools for windows, wget and 7zip. so you could have a cronw daemon running as a service on windows, and have it create copies of log files to a new location, which are then accessed by the FTP server, this way you get a backup as well as access to locked files. Copy them to another hard disk to be safest. |
|
|||
|
shimmyshack wrote:
> awstats is nice. > the script is triggered by visiting it in a browser of by using cron. > in my crontab its this (all on one line) (happens every day at 8 mins > past 3 in the morning) > 8 3 * * 0-6 wget --delete-after "http://server.com/backups/7z.php? > domain=www.blah.info&logging=file" > the script 7z.php is a small script that uses a call to 7zip to update > a compressed backup of the domain and various things about the domain. > In your case the script would just copy the log file, or FTP it to > another location. > you dont even need to use php for that kind of thing: > 1 14 * * 0 copy "path/to/logs/access.log" "/new/path/to/logs/ > access.log" > (happens at 1 mins past 2 every sunday afternoon) > > both scripts can be executed on the command line, wget is used as a > "browser" to make the request to the server script which does the hard > work. I script in php alot so writing backup scripts in php is an easy > thing, they dont have to run on the server though, you can use the > activescripting dll, and write scripts that can be doubled clicked on > or set off by scheduled tasks - although i think cronw is way better > than the i nbuilt scheduled tasks. > > The tools I use for automated stuff like this are unix tools for > windows, wget and 7zip. > so you could have a cronw daemon running as a service on windows, and > have it create copies of log files to a new location, which are then > accessed by the FTP server, this way you get a backup as well as > access to locked files. Copy them to another hard disk to be safest. Sorry for the delay in replying. Thank you for all the detailed information. My work has just got very busy so I'll have to get back to this in a week or so. I think I'll give AWStats a try and will also play with cronw. -- -Mike -- Posted via a free Usenet account from http://www.teranews.com |