![]() |
|
#1
|
||||
|
||||
How to search a huge text file for data?I have been trying for days to get this to work but obviously PHP's filesystem is not one of my fortes.
The large text file I want to 'search' is the website's access log file which is quite huge. So far I have tried: PHP Code:
Up to this point, I am already stuck; with even 1 day's worth of logs, this piece of code will time-out. If you run the Apache Web Server on your win32 PC, you can find the access log (and view the sample data) file usually at: Code:
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#2
|
||||
|
||||
|
Is the file opened ok? As it is now, you aren't doing any error checking whatsoever. I'd change the open line to
$fd = fopen('/path/to/access_log', 'r') or die("Couldn't open the file."); just a thought let me know if this help or not. __________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization. |
|
#3
|
||||
|
||||
|
nope, it's not the matter of error-checking... the file being searched is 47MB (give or take 3 bytes)!
so it's no wonder it times out... and i think i got a work-around but it works a bit retarded i'll tell you more when I send off an email to Scott of www.Vilitas.com warning him that I want to try out this script sometime in the near future. __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#4
|
||||
|
||||
|
Oh ok, Let me know.
__________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization. |
|
#5
|
||||
|
||||
|
Here's GIDGoogle™ ver. 0.0.1
http://topsites.gidhelp.com/get_google.php What it does is to grab any googlebot activity off your Apache logs... and it doesn't matter how large your log file is! Cool, I think. Once I get the script into a class and some other features added, I will offer it as a download too... __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#6
|
||||
|
||||
|
__________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization. |
|
#7
|
||||
|
||||
|
Did you ever create a download for this?
Rob |
|
#8
|
||||
|
||||
|
No, it was seriously flawed. So I went the route of GIDTrackbot™!
Also, figuring out Linux these days has certainly opened up many new possibilities to get the same results with much less processing overhead... one day I will figure out a new way to get this data out (but only off a linux server). __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
Recent GIDBlog
First week of IA training by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Manipulating text Files | k209310 | CPP / C++ Forum | 0 | 17-Nov-2003 10:23 |
| CD Buring Failed | skanth2000 | Computer Hardware Forum | 1 | 15-Nov-2003 03:52 |
| Search Engine Positioning 101 and 201 "How To" Tips... | 000 | Search Engine Optimization Forum | 0 | 29-May-2003 10:34 |
| [class] 404 search function code | jrobbio | MySQL / PHP Forum | 6 | 22-Apr-2003 09:32 |
| How Do i get php to find out the file type of a file for me? | viperman95833 | MySQL / PHP Forum | 2 | 08-Mar-2003 09:48 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The